{
  "openapi": "3.1.1",
  "info": {
    "title": "AURE TRAVEL Consultation API",
    "version": "1.0.0",
    "description": "Machine-readable access to AURE TRAVEL's personal travel consultation flow. Requests are non-binding and followed up personally by email.",
    "contact": {
      "name": "AURE TRAVEL",
      "email": "info@auretravel.de"
    }
  },
  "servers": [
    { "url": "/", "description": "Current AURE TRAVEL website" }
  ],
  "paths": {
    "/api/booking-config": {
      "get": {
        "operationId": "getBookingConfiguration",
        "summary": "Read the current booking mode",
        "description": "Returns either request mode or a verified Zoom Scheduler booking URL when direct booking has been enabled.",
        "responses": {
          "200": {
            "description": "Current configuration",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/BookingConfiguration" }
              }
            }
          }
        }
      }
    },
    "/api/consultation": {
      "get": {
        "operationId": "getConsultationCapabilities",
        "summary": "Discover consultation scheduling capabilities",
        "responses": {
          "200": {
            "description": "Capabilities and confirmation semantics",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ConsultationCapabilities" }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "requestTravelConsultation",
        "summary": "Request a personal travel consultation",
        "description": "Creates a non-binding consultation request. AURE TRAVEL responds personally by email to discuss the next steps and preferred contact channel.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ConsultationRequest" }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Request accepted and pending personal confirmation",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ConsultationAccepted" }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ApiError" }
              }
            }
          },
          "403": { "description": "Cross-site browser request blocked" },
          "413": { "description": "Request payload too large" },
          "415": { "description": "JSON request required" },
          "503": {
            "description": "Online request delivery is not configured",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ApiError" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BookingConfiguration": {
        "type": "object",
        "required": ["directBooking", "bookingUrl", "mode", "meetingPlatform", "requestEndpoint", "openApi"],
        "properties": {
          "directBooking": { "type": "boolean" },
          "bookingUrl": { "type": ["string", "null"], "format": "uri" },
          "mode": { "type": "string", "enum": ["direct", "request"] },
          "meetingPlatform": { "type": ["string", "null"], "enum": ["Zoom", null] },
          "requestEndpoint": { "type": "string", "const": "/api/consultation" },
          "openApi": { "type": "string", "const": "/openapi.json" }
        }
      },
      "ConsultationCapabilities": {
        "allOf": [
          { "$ref": "#/components/schemas/BookingConfiguration" },
          {
            "type": "object",
            "required": ["requestStatus", "confirmedOnRequest", "documentation"],
            "properties": {
              "requestStatus": { "type": "string", "const": "pending_confirmation" },
              "confirmedOnRequest": { "type": "boolean", "const": false },
              "documentation": { "type": "string", "const": "/openapi.json" }
            }
          }
        ]
      },
      "ConsultationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["name", "email", "preferredTime1", "privacyAcknowledged"],
        "properties": {
          "name": { "type": "string", "minLength": 2, "maxLength": 100 },
          "email": { "type": "string", "format": "email", "maxLength": 200 },
          "destination": { "type": "string", "maxLength": 120 },
          "style": { "type": "string", "maxLength": 120 },
          "period": { "type": "string", "maxLength": 120 },
          "travelers": { "type": "string", "maxLength": 20 },
          "preferredTime1": { "type": "string", "minLength": 1, "maxLength": 120, "description": "Requested date and time including time zone when outside Europe/Berlin." },
          "preferredTime2": { "type": "string", "maxLength": 120 },
          "wishes": { "type": "string", "maxLength": 1500 },
          "privacyAcknowledged": { "type": "boolean", "const": true }
        }
      },
      "ConsultationAccepted": {
        "type": "object",
        "required": ["ok", "requestId", "status", "confirmed", "nextStep"],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "requestId": { "type": "string", "format": "uuid" },
          "status": { "type": "string", "const": "pending_confirmation" },
          "confirmed": { "type": "boolean", "const": false },
          "nextStep": { "type": "string" }
        }
      },
      "ApiError": {
        "type": "object",
        "required": ["error", "code"],
        "properties": {
          "error": { "type": "string" },
          "code": { "type": "string" },
          "details": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["field", "code"],
              "properties": {
                "field": { "type": "string" },
                "code": { "type": "string" }
              }
            }
          }
        }
      }
    }
  }
}
