{
 "openapi": "3.1.0",
 "info": {
  "title": "ERA Phuket — salon booking API",
  "version": "1.0.0",
  "description": "Services, prices, free time slots and instant booking at ERA Barbershop & Beauty Space (Bang Tao, Phuket). Prices in THB. Times are Asia/Bangkok (UTC+7). The same tools are available over MCP at https://eraphuket.com/mcp",
  "contact": {
   "url": "https://eraphuket.com/ai/"
  }
 },
 "servers": [
  {
   "url": "https://eraphuket.com/api/ai"
  }
 ],
 "paths": {
  "/salon": {
   "get": {
    "operationId": "getSalonInfo",
    "summary": "Salon facts: address (EN + Thai for taxi), hours, contacts, languages, rating",
    "responses": {
     "200": {
      "description": "Salon info"
     }
    }
   }
  },
  "/services": {
   "get": {
    "operationId": "listServices",
    "summary": "Services with current prices (THB), durations and master levels",
    "parameters": [
     {
      "name": "audience",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "women",
        "men",
        "all"
       ]
      }
     },
     {
      "name": "q",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Search text in any language, e.g. \"manicure\", \"балаяж\", \"beard\""
     },
     {
      "name": "lang",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "en",
        "ru",
        "zh",
        "th",
        "de",
        "fr",
        "he"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Matching services"
     }
    }
   }
  },
  "/slots": {
   "get": {
    "operationId": "findAvailableSlots",
    "summary": "Free appointment times for one or more services (optionally with a specific master)",
    "parameters": [
     {
      "name": "service_ids",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "description": "Comma-separated Altegio service IDs from /services, e.g. \"13234322\" or \"13234322,13131226\""
      }
     },
     {
      "name": "staff_id",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "Master ID from /services or /salon; omit for any master"
     },
     {
      "name": "date",
      "in": "query",
      "schema": {
       "type": "string",
       "format": "date"
      },
      "description": "First day to check (YYYY-MM-DD, Asia/Bangkok). Default: today"
     },
     {
      "name": "days",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 7
      },
      "description": "How many bookable days to return (default 3)"
     }
    ],
    "responses": {
     "200": {
      "description": "Dates with free start times"
     }
    }
   }
  },
  "/bookings": {
   "post": {
    "operationId": "createBooking",
    "summary": "Book an appointment. Call only after the user explicitly confirmed all details.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "service_ids",
         "datetime",
         "client_name",
         "client_phone"
        ],
        "properties": {
         "service_ids": {
          "type": "array",
          "items": {
           "type": "integer"
          }
         },
         "staff_id": {
          "type": "integer",
          "description": "0 or omitted = any available master"
         },
         "datetime": {
          "type": "string",
          "description": "Start time from /slots, e.g. 2026-10-22T14:00:00+07:00"
         },
         "client_name": {
          "type": "string"
         },
         "client_phone": {
          "type": "string",
          "description": "International format, e.g. +66 81 234 5678"
         },
         "client_email": {
          "type": "string"
         },
         "comment": {
          "type": "string",
          "description": "Wishes for the master, language preference, reference photo note"
         },
         "lang": {
          "type": "string",
          "enum": [
           "en",
           "ru",
           "zh",
           "th",
           "de",
           "fr",
           "he"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Booking confirmed with record id"
     },
     "409": {
      "description": "Slot no longer available"
     },
     "429": {
      "description": "Too many attempts"
     }
    }
   }
  },
  "/booking-link": {
   "get": {
    "operationId": "getBookingLink",
    "summary": "A link where the user can finish booking themselves (service and master preselected)",
    "parameters": [
     {
      "name": "service_id",
      "in": "query",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "staff_id",
      "in": "query",
      "schema": {
       "type": "integer"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Booking URL"
     }
    }
   }
  }
 }
}