{
    "openapi": "3.0.0",
    "info": {
        "title": "Upsalt API",
        "description": "Upsalt API Documentation",
        "contact": {
            "email": "contact@upsalt.io"
        },
        "version": "1.0.0"
    },
    "paths": {
        "/api/company/{slug}/info": {
            "get": {
                "tags": [
                    "Company"
                ],
                "summary": "Get company information by slug",
                "description": "Retrieves comprehensive information about a company including its basic details, logos, floorplans, and active opening days",
                "operationId": "getCompanyInfo",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "description": "Company slug identifier (URL-friendly name)",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "example": "acme-corp"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Company information retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "id": {
                                                    "description": "Company unique ID",
                                                    "type": "integer",
                                                    "example": 1
                                                },
                                                "name": {
                                                    "description": "Company name",
                                                    "type": "string",
                                                    "example": "Acme Corporation"
                                                },
                                                "business": {
                                                    "description": "Company business type",
                                                    "type": "string",
                                                    "example": "Restaurant"
                                                },
                                                "companyLogo": {
                                                    "description": "URL to the company logo image",
                                                    "type": "string",
                                                    "format": "uri",
                                                    "example": "https://example.com/logo.png",
                                                    "nullable": true
                                                },
                                                "companyBackground": {
                                                    "description": "URL to the company background image",
                                                    "type": "string",
                                                    "format": "uri",
                                                    "example": "https://example.com/background.jpg",
                                                    "nullable": true
                                                },
                                                "floorplans": {
                                                    "description": "Array of floorplan IDs associated with this company",
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer",
                                                        "example": 1
                                                    }
                                                },
                                                "openings": {
                                                    "description": "Active company opening days with their IDs",
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "id": {
                                                                "description": "Opening ID",
                                                                "type": "integer",
                                                                "example": 1
                                                            },
                                                            "day": {
                                                                "description": "Day of the week in lowercase",
                                                                "type": "string",
                                                                "example": "monday"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                },
                                                "show_floorplan": {
                                                    "description": "Whether to show the floorplan in the UI",
                                                    "type": "boolean",
                                                    "example": true
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid input",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid company slug"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Company not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Company not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unable to retrieve company information"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/{company_id}/available-slots/{date}": {
            "get": {
                "tags": [
                    "Company"
                ],
                "summary": "Get available time slots for a specific date",
                "description": "Retrieves all available booking slots for a company on a given date, automatically determining the appropriate opening day",
                "operationId": "getAvailableSlots",
                "parameters": [
                    {
                        "name": "company_id",
                        "in": "path",
                        "description": "Company ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    },
                    {
                        "name": "date",
                        "in": "path",
                        "description": "Target date in format YYYY-MM-DD",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "example": "2025-02-10"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Available time slots retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "description": "Available time slots grouped by day and shift",
                                            "type": "object",
                                            "additionalProperties": {
                                                "description": "Shifts grouped by day",
                                                "type": "object",
                                                "additionalProperties": {
                                                    "description": "Available slots for a shift",
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "opening_id": {
                                                                "description": "ID of the opening slot",
                                                                "type": "integer",
                                                                "example": 25
                                                            },
                                                            "shift": {
                                                                "description": "Time of the shift",
                                                                "type": "string",
                                                                "example": "12:00"
                                                            },
                                                            "available": {
                                                                "description": "Number of available tables",
                                                                "type": "integer",
                                                                "example": 5
                                                            },
                                                            "booked": {
                                                                "description": "Array of IDs of tables already booked",
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "integer"
                                                                }
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Available slots retrieved successfully"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid date format",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid date format. Use YYYY-MM-DD"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No slots available or company not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "No active slots found for this day"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "An error occurred while processing the request"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/{company_id}/floorplan/{floorplan_id}/config": {
            "get": {
                "tags": [
                    "Floorplan"
                ],
                "summary": "Get floorplan configuration and assets by company ID and floorplan ID",
                "description": "Retrieves detailed floorplan configuration including layout data and associated assets for rendering",
                "operationId": "getFloorplanConfig",
                "parameters": [
                    {
                        "name": "company_id",
                        "in": "path",
                        "description": "Company ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    },
                    {
                        "name": "floorplan_id",
                        "in": "path",
                        "description": "Floorplan ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Floorplan configuration retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "floorplan": {
                                                    "description": "Floorplan details including configuration data",
                                                    "properties": {
                                                        "id": {
                                                            "description": "Floorplan ID",
                                                            "type": "integer",
                                                            "example": 1
                                                        },
                                                        "name": {
                                                            "description": "Name of the floorplan",
                                                            "type": "string",
                                                            "example": "Main Floor"
                                                        },
                                                        "json": {
                                                            "description": "FabricJS JSON string representing the floorplan layout",
                                                            "type": "string",
                                                            "example": "fabric-json-data"
                                                        }
                                                    },
                                                    "type": "object"
                                                },
                                                "assets": {
                                                    "description": "Collection of assets that can be used in the floorplan",
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "id": {
                                                                "description": "Asset ID",
                                                                "type": "integer",
                                                                "example": 1
                                                            },
                                                            "name": {
                                                                "description": "Asset name/type",
                                                                "type": "string",
                                                                "example": "Chair"
                                                            },
                                                            "url": {
                                                                "description": "URL to the asset image",
                                                                "type": "string",
                                                                "format": "uri",
                                                                "example": "https://example.com/assets/chair.svg"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Floorplan not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Floorplan not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unable to retrieve floorplan configuration"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/login": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "User login",
                "description": "Login api",
                "operationId": "4596fcabf8d77d24d6f88eb1a61ec784",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "password"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "user@example.com"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "password123"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Login successful",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "token": {
                                            "type": "string",
                                            "example": "6|laravel_sanctum_hGg7p1LY15DjdwZVsn9xA8..."
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "token"
                                        },
                                        "expires_in": {
                                            "type": "string",
                                            "example": "15 minutes"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorised."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/tokens/check": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Validate authentication token",
                "description": "Check if current token is valid",
                "operationId": "2196c058ff91067da1ac4c35b10ff225",
                "responses": {
                    "200": {
                        "description": "Token is valid",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "string",
                                            "example": "pouet pouet"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Token is valid."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized, invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/{type_id}/{slug}/{company_id}": {
            "post": {
                "tags": [
                    "Booking"
                ],
                "summary": "Create or update a guest booking",
                "description": "Creates a new booking or updates an existing one based on guest token",
                "operationId": "createOrUpdateGuestBooking",
                "parameters": [
                    {
                        "name": "type_id",
                        "in": "path",
                        "description": "Company type ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    },
                    {
                        "name": "slug",
                        "in": "path",
                        "description": "Company slug identifier",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "example": "acme-restaurant"
                        }
                    },
                    {
                        "name": "company_id",
                        "in": "path",
                        "description": "Company ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "requestBody": {
                    "description": "Guest booking information",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "guest": {
                                        "required": [
                                            "firstname",
                                            "lastname",
                                            "email",
                                            "phone",
                                            "date",
                                            "hour",
                                            "pax"
                                        ],
                                        "properties": {
                                            "firstname": {
                                                "type": "string",
                                                "example": "John"
                                            },
                                            "lastname": {
                                                "type": "string",
                                                "example": "Doe"
                                            },
                                            "email": {
                                                "type": "string",
                                                "format": "email",
                                                "example": "john.doe@example.com"
                                            },
                                            "phone": {
                                                "type": "string",
                                                "example": "+1234567890"
                                            },
                                            "date": {
                                                "type": "string",
                                                "format": "date",
                                                "example": "2023-01-15"
                                            },
                                            "hour": {
                                                "type": "string",
                                                "example": "19:30"
                                            },
                                            "pax": {
                                                "type": "integer",
                                                "example": 2
                                            },
                                            "guest_token": {
                                                "type": "string",
                                                "example": "abc123xyz",
                                                "nullable": true
                                            },
                                            "comment": {
                                                "type": "string",
                                                "example": "Window seat preferred",
                                                "nullable": true
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Booking created or updated successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "redirect_url": {
                                            "type": "string",
                                            "example": "/booking/response/valid/abc123xyz"
                                        },
                                        "type": {
                                            "type": "string",
                                            "example": "Success"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Your booking is confirmed!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "406": {
                        "description": "Error in booking process",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "redirect_url": {
                                            "type": "string",
                                            "example": "/booking/response/error"
                                        },
                                        "type": {
                                            "type": "string",
                                            "example": "Error"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Failed to save your booking, please try again later"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "tags": [
        {
            "name": "Company",
            "description": "Company"
        },
        {
            "name": "Floorplan",
            "description": "Floorplan"
        },
        {
            "name": "Authentication",
            "description": "Authentication"
        },
        {
            "name": "Booking",
            "description": "Booking"
        }
    ]
}