{
  "openapi": "3.1.0",
  "info": {
    "title": "ParkAtSEA Parking API",
    "version": "1.3.0",
    "description": "Direct allotment marketplace for SEA-TAC airport offsite parking. AI agents: search direct-lot availability, price a stay, create a booking hold (returns Stripe checkout_url - user must approve and pay there). Direct lots only; this API never queries or forwards to external parking providers."
  },
  "servers": [{ "url": "https://parkatsea.com" }],
  "paths": {
    "/api/search": {
      "get": {
        "operationId": "searchParking",
        "summary": "Search parking availability",
        "parameters": [
          { "in": "query", "name": "entry", "required": true, "schema": { "type": "string" } },
          { "in": "query", "name": "exit", "required": true, "schema": { "type": "string" } },
          { "in": "query", "name": "filter", "schema": { "type": "array", "items": { "type": "string" } } }
        ],
        "responses": { "200": { "description": "Availability search results" } }
      }
    },
    "/api/lots": {
      "get": {
        "operationId": "listLots",
        "summary": "List all lots",
        "responses": { "200": { "description": "All lots" } }
      }
    },
    "/api/pricing/calculate": {
      "post": {
        "operationId": "calculatePrice",
        "summary": "Price a stay",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "lot_id": { "type": "number" },
                  "entry_at": { "type": "string" },
                  "exit_at": { "type": "string" }
                },
                "required": ["lot_id", "entry_at", "exit_at"]
              }
            }
          }
        },
        "responses": { "200": { "description": "Price breakdown" } }
      }
    },
    "/api/book": {
      "post": {
        "operationId": "createBooking",
        "summary": "Create a booking hold and Stripe Checkout session",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/BookingRequest" }
            }
          }
        },
        "responses": {
          "200": { "description": "Booking hold created. Follow checkout_url for payment; booking confirms via Stripe webhook." },
          "400": { "description": "Validation error" },
          "409": { "description": "Sold out" }
        }
      }
    },
    "/api/mcp": {
      "get": {
        "summary": "MCP discovery",
        "responses": { "200": { "description": "MCP server info" } }
      },
      "post": {
        "summary": "MCP Streamable HTTP endpoint",
        "responses": { "200": { "description": "MCP JSON-RPC endpoint (initialize, tools/list, tools/call)" } }
      }
    }
  },
  "components": {
    "schemas": {
      "BookingRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "lot_id": { "type": "number", "description": "Direct lot id from /api/search" },
          "entry_at": { "type": "string", "description": "Entry datetime ISO, e.g. 2026-10-01T14:00:00" },
          "exit_at": { "type": "string", "description": "Exit datetime ISO" },
          "email": { "type": "string", "description": "Customer email for QR code and receipt" },
          "license_plate": { "type": "string" },
          "promo_code": { "type": "string" }
        },
        "required": ["lot_id", "entry_at", "exit_at", "email"]
      },
      "Lot": {
        "type": "object",
        "properties": {
          "id": { "type": "number" },
          "name": { "type": "string" },
          "address": { "type": "string" },
          "distance_mi": { "type": "number" },
          "price_per_day": { "type": "number" },
          "spots_left": { "type": "number" },
          "tags": { "type": "array", "items": { "type": "string" } }
        }
      }
    }
  }
}
