{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://booking.gogmo.tw/ucp/v1/schemas/transfer-booking.json",
  "name": "tw.gogmo.booking.transfer",
  "version": "2026-04-08",
  "title": "goGMO Airport Transfer Booking",
  "description": "UCP capability for quoting Taiwan airport transfer trips. The first release quotes only: the response carries status=requires_escalation and a continue_url where the buyer completes contact details and payment on booking.gogmo.tw. No card data is accepted by this API.",
  "type": "object",
  "$defs": {
    "ReverseDomainName": {
      "type": "string",
      "pattern": "^[a-z0-9-]+(\\.[a-z0-9-]+)+$"
    },
    "Amount": {
      "type": "integer",
      "description": "Amount in minor units of the currency. TWD has no decimal minor unit, so the value is New Taiwan Dollars.",
      "minimum": 0
    },
    "CreateRequest": {
      "type": "object",
      "description": "Create Booking Session request body.",
      "required": ["service_type", "airport", "date", "time", "address", "passengers"],
      "anyOf": [{ "required": ["zone_id"] }, { "required": ["district"] }],
      "additionalProperties": false,
      "properties": {
        "service_type": {
          "type": "string",
          "enum": ["pickup", "dropoff"],
          "description": "pickup = airport to address; dropoff = address to airport."
        },
        "airport": {
          "type": "string",
          "description": "IATA code or full Chinese airport name.",
          "examples": ["TPE", "TSA", "KHH", "桃園國際機場"]
        },
        "terminal": {
          "type": "string",
          "enum": ["T1", "T2"],
          "description": "Only for TPE (桃園國際機場). Omit for single-terminal airports."
        },
        "flight_number": {
          "type": "string",
          "description": "Recommended for pickup; used for arrival-time tracking and free waiting time.",
          "examples": ["BR123", "CI0001", "JX800"]
        },
        "date": {
          "type": "string",
          "format": "date",
          "description": "Departure date in Asia/Taipei, YYYY-MM-DD."
        },
        "time": {
          "type": "string",
          "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$",
          "description": "Departure time in Asia/Taipei, 24-hour HH:MM."
        },
        "zone_id": {
          "type": "string",
          "description": "Service area id from GET /ucp/v1/catalog. Preferred over district."
        },
        "district": {
          "type": "string",
          "description": "Taiwanese district name; resolved to a zone_id when zone_id is omitted.",
          "examples": ["大安區", "西屯區"]
        },
        "address": {
          "type": "string",
          "maxLength": 120,
          "description": "Full pickup/drop-off address for the driver."
        },
        "vehicle_type": {
          "type": "string",
          "enum": ["sedan", "suv", "van"],
          "description": "Omit to auto-select the smallest vehicle that fits passengers and luggage."
        },
        "passengers": { "type": "integer", "minimum": 1, "maximum": 8 },
        "luggage": {
          "oneOf": [
            { "type": "integer", "minimum": 0, "maximum": 8 },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "checked": { "type": "integer", "minimum": 0, "maximum": 8 },
                "carry_on": { "type": "integer", "minimum": 0, "maximum": 4 }
              }
            }
          ],
          "description": "Checked-bag count, or an object with checked and carry_on."
        },
        "addons": {
          "type": "array",
          "maxItems": 8,
          "items": {
            "type": "object",
            "required": ["id"],
            "additionalProperties": false,
            "properties": {
              "id": { "type": "string", "enum": ["child_seat", "extra_stop", "meet_and_greet"] },
              "quantity": { "type": "integer", "minimum": 1, "maximum": 8 }
            }
          }
        },
        "round_trip": {
          "type": "object",
          "description": "Round trip doubles the one-way total, matching the on-site booking rules.",
          "required": ["date", "time"],
          "additionalProperties": false,
          "properties": {
            "date": { "type": "string", "format": "date" },
            "time": { "type": "string", "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$" },
            "flight_number": { "type": "string" }
          }
        }
      }
    },
    "Total": {
      "type": "object",
      "required": ["type", "amount"],
      "properties": {
        "type": {
          "type": "string",
          "enum": ["subtotal", "fee", "discount", "tax", "total"]
        },
        "display_text": { "type": "string" },
        "amount": { "$ref": "#/$defs/Amount" }
      }
    },
    "Message": {
      "type": "object",
      "required": ["type", "content"],
      "properties": {
        "type": { "type": "string", "enum": ["info", "warning", "error"] },
        "code": { "type": "string" },
        "content": { "type": "string" },
        "content_type": { "type": "string", "enum": ["plain", "markdown", "html"] },
        "severity": {
          "type": "string",
          "enum": ["recoverable", "requires_buyer_input", "requires_buyer_review", "unrecoverable"]
        },
        "presentation": { "type": "string", "enum": ["notice", "disclosure"] },
        "path": { "type": "string" },
        "url": { "type": "string", "format": "uri" }
      }
    },
    "Link": {
      "type": "object",
      "required": ["type", "url"],
      "properties": {
        "type": { "type": "string" },
        "title": { "type": "string" },
        "url": { "type": "string", "format": "uri" }
      }
    },
    "Policy": {
      "type": "object",
      "required": ["type", "description"],
      "properties": {
        "type": { "$ref": "#/$defs/ReverseDomainName" },
        "description": {
          "type": "object",
          "properties": {
            "plain": { "type": "string" },
            "markdown": { "type": "string" },
            "html": { "type": "string" }
          }
        },
        "url": { "type": "string", "format": "uri" },
        "refundability": {
          "type": "string",
          "enum": ["refundable", "partially_refundable", "non_refundable"]
        }
      }
    },
    "Transfer": {
      "type": "object",
      "required": ["service_type", "airport", "schedule", "pickup", "vehicle", "passengers"],
      "properties": {
        "service_type": { "type": "string", "enum": ["pickup", "dropoff"] },
        "airport": {
          "type": "object",
          "required": ["code", "name"],
          "properties": {
            "code": { "type": "string" },
            "name": { "type": "string" },
            "terminal": { "type": "string" }
          }
        },
        "flight_number": { "type": "string" },
        "schedule": {
          "type": "object",
          "required": ["date", "time"],
          "properties": {
            "date": { "type": "string", "format": "date" },
            "time": { "type": "string" },
            "timezone": { "type": "string", "const": "Asia/Taipei" }
          }
        },
        "pickup": {
          "type": "object",
          "required": ["zone_id", "zone_name", "address"],
          "properties": {
            "zone_id": { "type": "string" },
            "zone_name": { "type": "string" },
            "address": { "type": "string" }
          }
        },
        "round_trip": {
          "type": "object",
          "properties": {
            "date": { "type": "string", "format": "date" },
            "time": { "type": "string" },
            "flight_number": { "type": "string" }
          }
        },
        "vehicle": {
          "type": "object",
          "required": ["id", "title"],
          "properties": {
            "id": { "type": "string", "enum": ["sedan", "suv", "van"] },
            "title": { "type": "string" },
            "passengers_max": { "type": "integer" },
            "luggage": {
              "type": "object",
              "properties": {
                "checked": { "type": "integer" },
                "carry_on": { "type": "integer" }
              }
            }
          }
        },
        "passengers": { "type": "integer" },
        "luggage": {
          "type": "object",
          "properties": {
            "checked": { "type": "integer" },
            "carry_on": { "type": "integer" }
          }
        },
        "addons": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": { "type": "string" },
              "title": { "type": "string" },
              "quantity": { "type": "integer" },
              "unit": { "type": "string" }
            }
          }
        }
      }
    },
    "UcpEnvelope": {
      "type": "object",
      "required": ["version"],
      "properties": {
        "version": { "type": "string" },
        "status": { "type": "string", "enum": ["success", "error"] },
        "capabilities": { "type": "object" },
        "payment_handlers": { "type": "object" }
      }
    },
    "BookingSession": {
      "type": "object",
      "required": ["ucp", "id", "status", "currency", "transfer", "totals"],
      "properties": {
        "ucp": { "$ref": "#/$defs/UcpEnvelope" },
        "id": { "type": "string" },
        "status": {
          "type": "string",
          "enum": ["incomplete", "requires_escalation", "ready_for_complete", "completed", "canceled"]
        },
        "currency": { "type": "string", "const": "TWD" },
        "transfer": { "$ref": "#/$defs/Transfer" },
        "totals": { "type": "array", "items": { "$ref": "#/$defs/Total" } },
        "policies": { "type": "array", "items": { "$ref": "#/$defs/Policy" } },
        "messages": { "type": "array", "items": { "$ref": "#/$defs/Message" } },
        "links": { "type": "array", "items": { "$ref": "#/$defs/Link" } },
        "continue_url": { "type": "string", "format": "uri" },
        "expires_at": { "type": "string", "format": "date-time" }
      },
      "allOf": [
        {
          "if": { "properties": { "status": { "const": "requires_escalation" } }, "required": ["status"] },
          "then": { "required": ["continue_url", "expires_at"] }
        }
      ]
    },
    "ErrorResponse": {
      "type": "object",
      "required": ["ucp", "messages"],
      "properties": {
        "ucp": { "$ref": "#/$defs/UcpEnvelope" },
        "id": { "type": "string" },
        "status": { "type": "string" },
        "messages": { "type": "array", "items": { "$ref": "#/$defs/Message" } },
        "continue_url": { "type": "string", "format": "uri" }
      }
    }
  }
}
