{
  "openapi": "3.1.0",
  "info": {
    "title": "Salon E booking enquiry API",
    "version": "1.0.0",
    "summary": "Send a booking enquiry to Salon E, a hair salon in Cashmere, Christchurch, New Zealand.",
    "description": "The same endpoint the booking form on https://salone.co.nz/book-a-consultation/ uses. An enquiry is saved and emailed to the salon, who contact the customer to confirm a time. It does not book or reserve a slot by itself and takes no payment. Name and phone are required. Please only send genuine enquiries from real customers, with their knowledge.",
    "contact": {"name": "Salon E", "email": "mail@salone.co.nz", "url": "https://salone.co.nz/book-a-consultation/"}
  },
  "servers": [{"url": "https://salone.co.nz"}],
  "paths": {
    "/book-a-consultation/": {
      "post": {
        "operationId": "sendBookingEnquiry",
        "summary": "Send a booking enquiry",
        "description": "Sends one enquiry to the salon. Accepts application/x-www-form-urlencoded or multipart/form-data. Requests from a browser page on another website are refused (an Origin header that is not salone.co.nz returns 403); server-side and agent clients that send no Origin header are fine.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {"schema": {"$ref": "#/components/schemas/Enquiry"}},
            "multipart/form-data": {"schema": {"$ref": "#/components/schemas/Enquiry"}}
          }
        },
        "responses": {
          "200": {"description": "Enquiry received. The body is an empty HTML fragment (<div></div>). A short-lived se_lead cookie is also set; clients can ignore it.", "content": {"text/html": {"schema": {"type": "string"}}}},
          "403": {"description": "Refused: the request came from a browser page on a different origin.", "content": {"text/html": {"schema": {"type": "string"}}}},
          "422": {"description": "Validation failed: name and phone are required, plus either a service or a message, and email (if given) must be a valid address. The body is an HTML fragment containing the error text.", "content": {"text/html": {"schema": {"type": "string"}}}},
          "500": {"description": "The enquiry could not be stored or emailed. Ask the customer to call 03 337 2270.", "content": {"text/html": {"schema": {"type": "string"}}}}
        }
      }
    },
    "/api/status": {
      "get": {
        "operationId": "getStatus",
        "summary": "Service status",
        "description": "Returns 200 with a small JSON body while the website and enquiry endpoint are running.",
        "responses": {
          "200": {"description": "Running.", "content": {"application/json": {"schema": {"type": "object", "required": ["status"], "properties": {"status": {"type": "string", "const": "ok"}}}}}}
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Enquiry": {
        "type": "object",
        "required": ["name", "phone"],
        "properties": {
          "name": {"type": "string", "maxLength": 120, "description": "Customer's name."},
          "phone": {"type": "string", "maxLength": 60, "description": "Phone number the salon can reach the customer on."},
          "email": {"type": "string", "format": "email", "maxLength": 160, "description": "Optional. Replies to the enquiry go to this address."},
          "service": {"type": "string", "maxLength": 60, "description": "Optional service of interest.", "examples": ["Hair colour", "Cut & style", "Keratin treatment", "Scalp analysis", "Not sure yet"]},
          "when": {"type": "string", "maxLength": 200, "description": "Optional preferred day or time, free text.", "examples": ["Thursday morning"]},
          "message": {"type": "string", "maxLength": 4000, "description": "What the customer would like. Required unless a service is given."},
          "website": {"type": "string", "description": "Spam trap. Always leave empty or omit."}
        }
      }
    }
  }
}
