{
  "openapi": "3.1.0",
  "info": {
    "title": "goGMO Airport Transfer — UCP REST service",
    "version": "2026-04-08",
    "description": "REST binding for capability tw.gogmo.booking.transfer. Quotes only: payment is completed by the buyer on booking.gogmo.tw through continue_url. Schema composition: payload shapes live in ../schemas/."
  },
  "servers": [
    { "url": "https://booking.gogmo.tw/ucp/v1" }
  ],
  "paths": {
    "/catalog": {
      "get": {
        "operationId": "get_catalog",
        "summary": "List airports, vehicles, service areas (with live fixed prices) and add-ons.",
        "parameters": [
          { "$ref": "#/components/parameters/UcpAgent" }
        ],
        "responses": {
          "200": {
            "description": "Catalog.",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/catalog.json" }
              }
            }
          },
          "503": {
            "description": "Pricing temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/booking-sessions": {
      "post": {
        "operationId": "create_booking_session",
        "summary": "Create a quote session and receive a continue_url for payment handoff.",
        "parameters": [
          { "$ref": "#/components/parameters/UcpAgent" },
          { "$ref": "#/components/parameters/IdempotencyKey" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/CreateRequest" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Quote created. status is requires_escalation and continue_url must be opened by the buyer.",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/BookingSession" }
              }
            }
          },
          "200": {
            "description": "Business outcome error (validation or capacity) in the UCP envelope.",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/ErrorResponse" }
              }
            }
          },
          "400": {
            "description": "Malformed JSON.",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/ErrorResponse" }
              }
            }
          },
          "429": {
            "description": "Rate limited.",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/booking-sessions/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": { "type": "string" }
        }
      ],
      "get": {
        "operationId": "get_booking_session",
        "summary": "Read a quote session (valid for 30 minutes).",
        "parameters": [
          { "$ref": "#/components/parameters/UcpAgent" }
        ],
        "responses": {
          "200": {
            "description": "Session, or a canceled envelope when expired.",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/BookingSession" }
              }
            }
          },
          "404": {
            "description": "Unknown or tampered session id.",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/ErrorResponse" }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "update_booking_session",
        "summary": "Not supported in v1 — create a new session instead.",
        "responses": {
          "501": {
            "description": "operation_not_supported",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/booking-sessions/{id}/cancel": {
      "post": {
        "operationId": "cancel_booking_session",
        "summary": "Not supported in v1 — quotes are stateless and expire automatically after 30 minutes.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          },
          { "$ref": "#/components/parameters/UcpAgent" }
        ],
        "responses": {
          "501": {
            "description": "cancel_not_supported",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/ErrorResponse" }
              }
            }
          },
          "404": {
            "description": "Unknown or tampered session id.",
            "content": {
              "application/json": {
                "schema": { "$ref": "../schemas/transfer-booking.json#/$defs/ErrorResponse" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "UcpAgent": {
        "name": "UCP-Agent",
        "in": "header",
        "required": false,
        "description": "Platform profile URI, Dictionary Structured Field syntax: profile=\"https://platform.example/.well-known/ucp\". Not required for public quoting; used for attribution and logging.",
        "schema": { "type": "string" }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Accepted for compatibility. Quoting is side-effect free and stateless, so replaying the same body yields an equivalent session.",
        "schema": { "type": "string" }
      }
    }
  }
}
