{
  "openapi": "3.1.0",
  "info": {
    "title": "SyncReserve Platform API",
    "version": "v1",
    "description": "Generated platform contract for SyncReserve external reads and authenticated automation access."
  },
  "servers": [
    {
      "url": "https://syncreserve.com"
    }
  ],
  "paths": {
    "/api/v1/platform/tenant/profile": {
      "get": {
        "operationId": "getTenantProfile",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantProfileResponse"
                }
              }
            }
          },
          "default": {
            "description": "Platform error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          }
        },
        "x-syncreserve-scopes": ["tenant:profile:read"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/analytics/summary": {
      "get": {
        "operationId": "getAnalyticsSummary",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "startDate",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "endDate",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Analytics summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformAnalyticsSummaryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          },
          "default": {
            "description": "Platform error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          }
        },
        "x-syncreserve-scopes": ["analytics:read"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/apps": {
      "get": {
        "operationId": "listPlatformApps",
        "security": [
          {
            "adminSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Platform apps in the tenant developers workspace"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "platform_default"
      },
      "post": {
        "operationId": "createPlatformApp",
        "security": [
          {
            "adminSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name", "allowedOrigins"],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "allowedOrigins": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "maxItems": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Platform app created"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/apps/{appId}": {
      "patch": {
        "operationId": "updatePlatformApp",
        "security": [
          {
            "adminSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "appId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name", "allowedOrigins"],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "allowedOrigins": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "maxItems": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Platform app updated"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "platform_default"
      },
      "delete": {
        "operationId": "deletePlatformApp",
        "security": [
          {
            "adminSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "appId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Platform app deleted"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/keys": {
      "get": {
        "operationId": "listPlatformApiKeys",
        "security": [
          {
            "adminSession": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "appId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Platform API keys for an app"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "platform_default"
      },
      "post": {
        "operationId": "createPlatformApiKey",
        "security": [
          {
            "adminSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["appId", "mode", "type"],
                "properties": {
                  "appId": {
                    "type": "string"
                  },
                  "mode": {
                    "type": "string",
                    "enum": ["live", "test"]
                  },
                  "type": {
                    "type": "string",
                    "enum": ["secret", "restricted"]
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "tenant:profile:read",
                        "analytics:read",
                        "bookings:discovery:read",
                        "export:read",
                        "events:read",
                        "webhooks:manage",
                        "bookings:write",
                        "checkins:write"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Platform API key created"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/keys/{keyId}": {
      "delete": {
        "operationId": "revokePlatformApiKey",
        "security": [
          {
            "adminSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "keyId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Platform API key revoked"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/keys/{keyId}/rotate": {
      "post": {
        "operationId": "rotatePlatformApiKey",
        "security": [
          {
            "adminSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "keyId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["appId"],
                "properties": {
                  "appId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Platform API key rotated"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/reports/export-jobs": {
      "get": {
        "operationId": "listExportJobs",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Export job list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformExportJobListResponse"
                }
              }
            }
          },
          "default": {
            "description": "Platform error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          }
        },
        "x-syncreserve-scopes": ["export:read"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      },
      "post": {
        "operationId": "createExportJob",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["reportType", "format"],
                "properties": {
                  "reportType": {
                    "type": "string",
                    "enum": ["analytics_summary", "tenant_profile"]
                  },
                  "format": {
                    "type": "string",
                    "enum": ["csv", "json"]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Queued export job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformExportJobResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          },
          "default": {
            "description": "Platform error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          }
        },
        "x-syncreserve-scopes": ["export:read"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/events/feed": {
      "get": {
        "operationId": "listPlatformEvents",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "eventFamily",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["booking", "payment", "membership", "session", "export"]
            }
          },
          {
            "in": "query",
            "name": "livemode",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cursor-ordered platform events",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEventListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          },
          "default": {
            "description": "Platform error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          }
        },
        "x-syncreserve-scopes": ["events:read"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/mcp": {
      "post": {
        "operationId": "handlePlatformMcpRequest",
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["jsonrpc", "method"],
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "enum": ["2.0"]
                  },
                  "id": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "method": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "MCP JSON-RPC response"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "platform_default"
      },
      "delete": {
        "operationId": "closePlatformMcpSession",
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "mcp-session-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "MCP session closed"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/webhooks": {
      "get": {
        "operationId": "listPlatformWebhooks",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook subscriptions for the authenticated app",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebhookListResponse"
                }
              }
            }
          },
          "default": {
            "description": "Platform error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          }
        },
        "x-syncreserve-scopes": ["webhooks:manage"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      },
      "post": {
        "operationId": "registerPlatformWebhook",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["url"],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "eventFilters": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": ["booking", "payment", "membership", "session", "export"]
                    }
                  },
                  "livemode": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook subscription and signing secret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebhookResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          },
          "default": {
            "description": "Platform error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformErrorEnvelope"
                }
              }
            }
          }
        },
        "x-syncreserve-scopes": ["webhooks:manage"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/webhooks/{id}": {
      "get": {
        "operationId": "getPlatformWebhook",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook subscription detail"
          }
        },
        "x-syncreserve-scopes": ["webhooks:manage"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      },
      "patch": {
        "operationId": "updatePlatformWebhook",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "eventFilters": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": ["booking", "payment", "membership", "session", "export"]
                    }
                  },
                  "active": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated webhook subscription"
          }
        },
        "x-syncreserve-scopes": ["webhooks:manage"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      },
      "delete": {
        "operationId": "deletePlatformWebhook",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted webhook subscription"
          }
        },
        "x-syncreserve-scopes": ["webhooks:manage"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/webhooks/{id}/logs": {
      "get": {
        "operationId": "listPlatformWebhookLogs",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook delivery logs"
          }
        },
        "x-syncreserve-scopes": ["webhooks:manage"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/webhooks/{id}/replay": {
      "post": {
        "operationId": "replayPlatformWebhookEvent",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["eventId"],
                "properties": {
                  "eventId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replay accepted"
          }
        },
        "x-syncreserve-scopes": ["webhooks:manage"],
        "x-syncreserve-rate-limit-tier": "platform_default"
      }
    },
    "/api/v1/platform/bookings": {
      "post": {
        "operationId": "createPlatformBookingHold",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["resourceId", "startTime", "endTime", "duration", "totalAmount"],
                "properties": {
                  "resourceId": {
                    "type": "string"
                  },
                  "guestId": {
                    "type": "string"
                  },
                  "startTime": {
                    "type": "integer"
                  },
                  "endTime": {
                    "type": "integer"
                  },
                  "duration": {
                    "type": "integer"
                  },
                  "totalAmount": {
                    "type": "integer"
                  },
                  "playerCount": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Booking hold created"
          }
        },
        "x-syncreserve-scopes": ["bookings:write"],
        "x-syncreserve-rate-limit-tier": "platform_premium"
      }
    },
    "/api/v1/platform/check-ins": {
      "post": {
        "operationId": "createPlatformCheckIn",
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["bookingId", "checkedInBy"],
                "properties": {
                  "bookingId": {
                    "type": "string"
                  },
                  "checkedInBy": {
                    "type": "string"
                  },
                  "actualPlayerCount": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Booking checked in"
          }
        },
        "x-syncreserve-scopes": ["checkins:write"],
        "x-syncreserve-rate-limit-tier": "platform_premium"
      }
    },
    "/api/v1/platform/oauth/authorize": {
      "get": {
        "operationId": "authorizePlatformApp",
        "parameters": [
          {
            "in": "query",
            "name": "client_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "response_type",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "redirect_uri",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "state",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "code_challenge",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "code_challenge_method",
            "required": true,
            "schema": {
              "type": "string",
              "enum": ["S256"]
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the client callback URI with the authorization code"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "public"
      }
    },
    "/api/v1/platform/oauth/token": {
      "post": {
        "operationId": "exchangePlatformOauthToken",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": ["grant_type", "client_id"],
                "properties": {
                  "grant_type": {
                    "type": "string",
                    "enum": ["authorization_code", "refresh_token"]
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  },
                  "redirect_uri": {
                    "type": "string"
                  },
                  "code_verifier": {
                    "type": "string"
                  },
                  "refresh_token": {
                    "type": "string"
                  },
                  "scope": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OAuth access token response"
          }
        },
        "x-syncreserve-scopes": [],
        "x-syncreserve-rate-limit-tier": "public"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "adminSession": {
        "type": "apiKey",
        "in": "cookie",
        "name": "admin_auth_token"
      },
      "bearerApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key"
      },
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://syncreserve.com/api/v1/platform/oauth/authorize",
            "tokenUrl": "https://syncreserve.com/api/v1/platform/oauth/token",
            "scopes": {
              "tenant:profile:read": "Read tenant profile",
              "analytics:read": "Read analytics data",
              "export:read": "Read export jobs",
              "events:read": "Read platform events",
              "webhooks:manage": "Manage platform webhooks",
              "bookings:write": "Create premium booking holds",
              "checkins:write": "Create premium booking check-ins"
            }
          }
        }
      }
    },
    "schemas": {
      "PlatformValidationIssue": {
        "type": "object",
        "required": ["path", "message"],
        "properties": {
          "path": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "PlatformPagination": {
        "type": "object",
        "required": ["nextCursor", "hasMore"],
        "properties": {
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "PlatformErrorEnvelope": {
        "type": "object",
        "required": ["schemaVersion", "success", "error"],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": ["v1"]
          },
          "success": {
            "type": "boolean",
            "enum": [false]
          },
          "error": {
            "type": "object",
            "required": ["status", "code", "message"],
            "properties": {
              "status": {
                "type": "integer"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retryAfter": {
                "type": "integer"
              },
              "details": {
                "oneOf": [
                  {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PlatformValidationIssue"
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": true
                  }
                ]
              }
            }
          }
        }
      },
      "PlatformTenantProfileData": {
        "type": "object",
        "required": ["schemaVersion", "generatedAt", "tenant", "classification", "experience"],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": ["platform.tenant.v1alpha1"]
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "tenant": {
            "type": "object",
            "required": ["id", "slug", "domain", "name", "timezone"],
            "properties": {
              "id": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "domain": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "name": {
                "type": "string"
              },
              "timezone": {
                "type": "string"
              }
            }
          },
          "classification": {
            "type": "object",
            "required": [
              "industry",
              "businessModel",
              "experiencePreset",
              "docsTrack",
              "platformReadinessLevel",
              "metadata"
            ],
            "properties": {
              "industry": {
                "type": "string",
                "enum": ["RACQUETS", "MARTIAL_ARTS"]
              },
              "businessModel": {
                "type": "string",
                "enum": ["TRADITIONAL_CLUB", "EATERTAINMENT", "ACADEMY", "FRANCHISE"]
              },
              "experiencePreset": {
                "type": "string",
                "enum": [
                  "RACQUETS_TRADITIONAL_CLUB",
                  "RACQUETS_EATERTAINMENT",
                  "MARTIAL_ARTS_ACADEMY",
                  "MARTIAL_ARTS_FRANCHISE"
                ]
              },
              "docsTrack": {
                "type": "string",
                "enum": ["traditional-club", "eatertainment", "academy", "franchise-ops"]
              },
              "platformReadinessLevel": {
                "type": "string",
                "enum": ["current_product", "foundation"]
              },
              "metadata": {
                "type": "object",
                "required": [
                  "capabilityOverridesUpdatedAt",
                  "capabilityOverridesUpdatedBy",
                  "classificationSource",
                  "classificationUpdatedAt",
                  "tenantModelVersion"
                ],
                "properties": {
                  "capabilityOverridesUpdatedAt": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "capabilityOverridesUpdatedBy": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "classificationSource": {
                    "type": "string",
                    "enum": ["explicit", "legacy_fallback"]
                  },
                  "classificationUpdatedAt": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "tenantModelVersion": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "experience": {
            "type": "object",
            "required": [
              "capabilities",
              "capabilityPacks",
              "policies",
              "recommendedIntegrations",
              "agentSurfaceProfile"
            ],
            "properties": {
              "capabilities": {
                "type": "object",
                "required": [
                  "accessControl",
                  "credits",
                  "demandPricing",
                  "equipmentRentals",
                  "fnb",
                  "giftCards",
                  "houseAccounts",
                  "kiosk",
                  "lessons",
                  "memberships",
                  "multiActivity",
                  "openGames",
                  "parties",
                  "programs",
                  "queue",
                  "ratings",
                  "reservationBundles",
                  "rfid",
                  "waivers"
                ],
                "properties": {
                  "accessControl": {
                    "type": "boolean"
                  },
                  "credits": {
                    "type": "boolean"
                  },
                  "demandPricing": {
                    "type": "boolean"
                  },
                  "equipmentRentals": {
                    "type": "boolean"
                  },
                  "fnb": {
                    "type": "boolean"
                  },
                  "giftCards": {
                    "type": "boolean"
                  },
                  "houseAccounts": {
                    "type": "boolean"
                  },
                  "kiosk": {
                    "type": "boolean"
                  },
                  "lessons": {
                    "type": "boolean"
                  },
                  "memberships": {
                    "type": "boolean"
                  },
                  "multiActivity": {
                    "type": "boolean"
                  },
                  "openGames": {
                    "type": "boolean"
                  },
                  "parties": {
                    "type": "boolean"
                  },
                  "programs": {
                    "type": "boolean"
                  },
                  "queue": {
                    "type": "boolean"
                  },
                  "ratings": {
                    "type": "boolean"
                  },
                  "reservationBundles": {
                    "type": "boolean"
                  },
                  "rfid": {
                    "type": "boolean"
                  },
                  "waivers": {
                    "type": "boolean"
                  }
                }
              },
              "capabilityPacks": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "club_core",
                    "eatertainment_core",
                    "academy_core",
                    "franchise_ops",
                    "commerce_addons",
                    "community_play",
                    "instruction_ops",
                    "bundled_reservations",
                    "messaging_ai",
                    "enterprise_governance"
                  ]
                }
              },
              "policies": {
                "type": "object",
                "required": [
                  "bookingWindowMode",
                  "guestIdentityMode",
                  "landingModules",
                  "membershipPresentation",
                  "navigationPreset",
                  "onboardingPreset",
                  "openGamesAccessMode",
                  "pricingPresentation"
                ],
                "properties": {
                  "bookingWindowMode": {
                    "type": "string"
                  },
                  "guestIdentityMode": {
                    "type": "string"
                  },
                  "landingModules": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "reserve",
                        "openGames",
                        "intro",
                        "programs",
                        "lessons",
                        "memberships",
                        "giftCards",
                        "credits",
                        "waivers",
                        "myAccount"
                      ]
                    }
                  },
                  "membershipPresentation": {
                    "type": "string"
                  },
                  "navigationPreset": {
                    "type": "string",
                    "enum": ["TRADITIONAL_CLUB", "EATERTAINMENT", "ACADEMY", "FRANCHISE"]
                  },
                  "onboardingPreset": {
                    "type": "string",
                    "enum": ["TRADITIONAL_CLUB", "EATERTAINMENT", "ACADEMY", "FRANCHISE"]
                  },
                  "openGamesAccessMode": {
                    "type": "string"
                  },
                  "pricingPresentation": {
                    "type": "string"
                  }
                }
              },
              "recommendedIntegrations": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": ["stripe", "twilio_sms", "twilio_whatsapp"]
                }
              },
              "agentSurfaceProfile": {
                "type": "object",
                "required": ["adminFocus", "defaultEntryPoint", "guestContext", "primaryFlows"],
                "properties": {
                  "adminFocus": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "defaultEntryPoint": {
                    "type": "string",
                    "enum": [
                      "member_assistant",
                      "social_booking",
                      "academy_operations",
                      "franchise_control_plane"
                    ]
                  },
                  "guestContext": {
                    "type": "string",
                    "enum": ["CONTACT_FIRST", "HYBRID", "ACCOUNT_FIRST"]
                  },
                  "primaryFlows": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "PlatformAnalyticsSummaryData": {
        "type": "object",
        "required": ["tenantId", "window", "totals"],
        "properties": {
          "tenantId": {
            "type": "string"
          },
          "window": {
            "type": "object",
            "required": ["startDate", "endDate"],
            "properties": {
              "startDate": {
                "type": "string",
                "format": "date"
              },
              "endDate": {
                "type": "string",
                "format": "date"
              }
            }
          },
          "totals": {
            "type": "object",
            "required": [
              "bookings",
              "completedBookings",
              "cancelledBookings",
              "noShows",
              "revenueCents",
              "uniqueGuests"
            ],
            "properties": {
              "bookings": {
                "type": "integer"
              },
              "completedBookings": {
                "type": "integer"
              },
              "cancelledBookings": {
                "type": "integer"
              },
              "noShows": {
                "type": "integer"
              },
              "revenueCents": {
                "type": "integer"
              },
              "uniqueGuests": {
                "type": "integer"
              }
            }
          }
        }
      },
      "PlatformExportJobData": {
        "type": "object",
        "required": ["id", "status", "reportType", "format", "createdAt", "completedAt"],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["queued", "processing", "completed", "failed"]
          },
          "reportType": {
            "type": "string",
            "enum": ["analytics_summary", "tenant_profile"]
          },
          "format": {
            "type": "string",
            "enum": ["csv", "json"]
          },
          "createdAt": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PlatformEventData": {
        "type": "object",
        "required": [
          "id",
          "type",
          "eventFamily",
          "tenantId",
          "livemode",
          "createdAt",
          "data",
          "apiVersion"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "booking.hold_created",
              "booking.checked_in",
              "booking.confirmed",
              "booking.cancelled",
              "booking.completed",
              "booking.no_show",
              "payment.received",
              "payment.refunded",
              "payment.failed",
              "membership.created",
              "membership.renewed",
              "membership.cancelled",
              "session.created",
              "session.updated",
              "session.cancelled",
              "export.completed"
            ]
          },
          "eventFamily": {
            "type": "string",
            "enum": ["booking", "payment", "membership", "session", "export"]
          },
          "tenantId": {
            "type": "string"
          },
          "livemode": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "integer"
          },
          "data": {
            "type": "object",
            "additionalProperties": true
          },
          "apiVersion": {
            "type": "string"
          }
        }
      },
      "PlatformWebhookSubscriptionData": {
        "type": "object",
        "required": ["id", "url", "eventFilters", "livemode", "active", "createdAt"],
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "eventFilters": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["booking", "payment", "membership", "session", "export"]
            }
          },
          "livemode": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "integer"
          }
        }
      },
      "PlatformWebhookWithSecretData": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformWebhookSubscriptionData"
          },
          {
            "type": "object",
            "required": ["signingSecret"],
            "properties": {
              "signingSecret": {
                "type": "string",
                "pattern": "^whsec_"
              }
            }
          }
        ]
      },
      "PlatformTenantProfileResponse": {
        "type": "object",
        "required": ["schemaVersion", "success", "data"],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": ["v1"]
          },
          "success": {
            "type": "boolean",
            "enum": [true]
          },
          "data": {
            "$ref": "#/components/schemas/PlatformTenantProfileData"
          }
        }
      },
      "PlatformAnalyticsSummaryResponse": {
        "type": "object",
        "required": ["schemaVersion", "success", "data"],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": ["v1"]
          },
          "success": {
            "type": "boolean",
            "enum": [true]
          },
          "data": {
            "$ref": "#/components/schemas/PlatformAnalyticsSummaryData"
          }
        }
      },
      "PlatformExportJobResponse": {
        "type": "object",
        "required": ["schemaVersion", "success", "data"],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": ["v1"]
          },
          "success": {
            "type": "boolean",
            "enum": [true]
          },
          "data": {
            "$ref": "#/components/schemas/PlatformExportJobData"
          }
        }
      },
      "PlatformExportJobListResponse": {
        "type": "object",
        "required": ["schemaVersion", "success", "data", "pagination"],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": ["v1"]
          },
          "success": {
            "type": "boolean",
            "enum": [true]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformExportJobData"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PlatformPagination"
          }
        }
      },
      "PlatformEventListResponse": {
        "type": "object",
        "required": ["schemaVersion", "success", "data", "pagination"],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": ["v1"]
          },
          "success": {
            "type": "boolean",
            "enum": [true]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformEventData"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PlatformPagination"
          }
        }
      },
      "PlatformWebhookListResponse": {
        "type": "object",
        "required": ["schemaVersion", "success", "data"],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": ["v1"]
          },
          "success": {
            "type": "boolean",
            "enum": [true]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformWebhookSubscriptionData"
            }
          }
        }
      },
      "PlatformWebhookResponse": {
        "type": "object",
        "required": ["schemaVersion", "success", "data"],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": ["v1"]
          },
          "success": {
            "type": "boolean",
            "enum": [true]
          },
          "data": {
            "$ref": "#/components/schemas/PlatformWebhookWithSecretData"
          }
        }
      }
    }
  }
}
