{
    "openapi": "3.0.0",
    "info": {
        "title": "Booking SP API",
        "description": "API",
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "https://api.lascene.cz/api",
            "description": "API Server"
        }
    ],
    "paths": {
        "/auth/token": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Login and get Bearer token",
                "operationId": "ba97663c3a041eb3e376aaca9a4a5213",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "username",
                                    "password"
                                ],
                                "properties": {
                                    "username": {
                                        "type": "string"
                                    },
                                    "password": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Token generated"
                    },
                    "401": {
                        "description": "Invalid credentials"
                    }
                },
                "security": []
            }
        },
        "/availability": {
            "post": {
                "tags": [
                    "Availability"
                ],
                "summary": "Get restaurant availability from SQL Server procedure",
                "operationId": "a5c3086d6c8956dddc66f2cf2f7a3e32",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "StartDate",
                                    "EndDate"
                                ],
                                "properties": {
                                    "StartDate": {
                                        "type": "string",
                                        "format": "date",
                                        "example": "2026-06-17"
                                    },
                                    "EndDate": {
                                        "type": "string",
                                        "format": "date",
                                        "example": "2026-07-17"
                                    },
                                    "Timezone": {
                                        "description": "Optional IANA timezone identifier. Invalid values are rejected with \"Invalid timezone/date.\"",
                                        "type": "string",
                                        "example": "Europe/Skopje"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "422": {
                        "description": "Validation error"
                    },
                    "500": {
                        "description": "Server error"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/booking/prepare": {
            "post": {
                "tags": [
                    "Booking"
                ],
                "summary": "Prepare booking via SQL Server procedure",
                "operationId": "97bf6f163d6248baac6c9231c5f58632",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "ShowID",
                                    "TargetDate",
                                    "BookingMode"
                                ],
                                "properties": {
                                    "ShowID": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "TargetDate": {
                                        "type": "string",
                                        "format": "date-time",
                                        "example": "2026-06-17T00:00:00"
                                    },
                                    "BookingMode": {
                                        "type": "integer",
                                        "example": 3
                                    },
                                    "CategoryID": {
                                        "description": "Optional category ID",
                                        "type": "integer",
                                        "example": 3,
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "422": {
                        "description": "Validation error"
                    },
                    "500": {
                        "description": "Server error"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/booking/book": {
            "post": {
                "tags": [
                    "Booking"
                ],
                "summary": "Create booking",
                "operationId": "84731a8ab972e45d2538ff992146b42d",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "ShowID",
                                    "TargetDate",
                                    "CustomerName",
                                    "Phone",
                                    "Email",
                                    "Items"
                                ],
                                "properties": {
                                    "ShowID": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "TargetDate": {
                                        "type": "string",
                                        "format": "date",
                                        "example": "2026-06-17"
                                    },
                                    "CustomerName": {
                                        "type": "string",
                                        "example": "John Doe"
                                    },
                                    "Phone": {
                                        "type": "string",
                                        "example": "+38970123456"
                                    },
                                    "Email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "john@example.com"
                                    },
                                    "Note": {
                                        "type": "string",
                                        "example": "Birthday reservation"
                                    },
                                    "Items": {
                                        "type": "array",
                                        "items": {
                                            "required": [
                                                "ItemKey",
                                                "Quantity"
                                            ],
                                            "properties": {
                                                "ItemKey": {
                                                    "type": "integer",
                                                    "example": 123
                                                },
                                                "Quantity": {
                                                    "type": "integer",
                                                    "example": 2
                                                }
                                            },
                                            "type": "object"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Booking created successfully"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "422": {
                        "description": "Validation error"
                    },
                    "500": {
                        "description": "Server error"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/booking": {
            "get": {
                "tags": [
                    "Booking"
                ],
                "summary": "Get booking by ID",
                "operationId": "c3d6a67af4ba6ebfeaa5a3de3767ff87",
                "parameters": [
                    {
                        "name": "BookingID",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Booking found"
                    },
                    "404": {
                        "description": "Booking not found"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "422": {
                        "description": "Validation error"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/mytimezone": {
            "get": {
                "tags": [
                    "Timezone"
                ],
                "summary": "Get the timezone of the caller, resolved by IP geolocation",
                "description": "Resolves the client IP and looks up its timezone via IP geolocation. Falls back to the server timezone when the IP is private/local or the lookup fails.",
                "operationId": "64c0dcab376a377228e0cfd27be19dec",
                "responses": {
                    "200": {
                        "description": "Resolved timezone"
                    },
                    "500": {
                        "description": "Server error"
                    }
                },
                "security": []
            }
        },
        "/gettimezone": {
            "get": {
                "tags": [
                    "Timezone"
                ],
                "summary": "Get all supported timezones",
                "description": "Returns every IANA timezone identifier accepted by the Timezone field of /availability.",
                "operationId": "37161ea30d263b012bb9afbe29735791",
                "responses": {
                    "200": {
                        "description": "List of all timezone identifiers"
                    },
                    "500": {
                        "description": "Server error"
                    }
                },
                "security": []
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "bearerFormat": "JWT",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Auth",
            "description": "Authentication endpoints"
        },
        {
            "name": "Availability",
            "description": "Availability endpoints"
        },
        {
            "name": "Booking",
            "description": "Booking endpoints"
        },
        {
            "name": "Timezone",
            "description": "Timezone endpoints"
        }
    ]
}