{
  "openapi": "3.1.0",
  "info": {
    "title": "China Care Bridge public data API",
    "version": "1.0.0",
    "description": "Read-only access to public care-pathway planning data. No authentication, no write operations, no personal data. Responses are generated from the same source data as the website."
  },
  "servers": [
    { "url": "https://china-care-bridge-e74.pages.dev", "description": "Placeholder origin; replace after domain binding" }
  ],
  "paths": {
    "/api/pathways": {
      "get": {
        "operationId": "getPathways",
        "summary": "List care pathways, or get one by identifier",
        "description": "Without parameters returns the full published set. With a valid id returns one record. An empty id is a validation error (400); an unknown id is a not-found (404). The same path implements both cases; there is no separate /api/pathways/{id} route.",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": false,
            "description": "Stable pathway identifier. Omit to list all pathways.",
            "schema": { "type": "string" },
            "example": "diagnostic-second-opinion"
          }
        ],
        "responses": {
          "200": {
            "description": "A pathway list, or a single pathway when id is supplied.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": ["data", "meta"],
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": ["id", "title", "summary", "url"],
                            "properties": {
                              "id": { "type": "string", "example": "diagnostic-second-opinion" },
                              "title": { "type": "string" },
                              "summary": { "type": "string" },
                              "url": { "type": "string", "format": "uri" }
                            }
                          }
                        },
                        "meta": {
                          "type": "object",
                          "required": ["count", "lastModified", "sourceUrl"],
                          "properties": {
                            "count": { "type": "integer", "minimum": 0 },
                            "lastModified": { "type": "string", "format": "date" },
                            "sourceUrl": { "type": "string", "format": "uri" }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": ["data", "meta"],
                      "properties": {
                        "data": {
                          "type": "object",
                          "required": ["id", "title", "summary", "typicalSteps", "planningNotes", "sourceUrl", "pageUrl"],
                          "properties": {
                            "id": { "type": "string" },
                            "title": { "type": "string" },
                            "summary": { "type": "string" },
                            "typicalSteps": { "type": "array", "items": { "type": "string" } },
                            "planningNotes": { "type": "string" },
                            "sourceUrl": { "type": "string", "format": "uri" },
                            "pageUrl": { "type": "string", "format": "uri" }
                          }
                        },
                        "meta": {
                          "type": "object",
                          "required": ["lastModified"],
                          "properties": { "lastModified": { "type": "string", "format": "date" } }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": { "description": "The id query parameter was present but empty." },
          "404": { "description": "No pathway matches the supplied identifier." },
          "405": { "description": "Method not allowed." }
        }
      }
    }
  },
  "security": [],
  "tags": [{ "name": "public-data", "description": "Public, read-only planning data" }]
}
