{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.connectsoft.ai/reference/schemas/blueprint-api-gateway.schema.json",
  "title": "API Gateway Blueprint (blueprint-api-gateway-v1)",
  "description": "Descriptor document of the API Gateway Blueprint kind (BC-02). Validated by BlueprintService; metadata per blueprint-common.schema.json; generation outputs and validation rules per model/blueprints.yaml.",
  "type": "object",
  "required": [
    "metadata",
    "template",
    "gatewayRole",
    "routes",
    "auth"
  ],
  "additionalProperties": false,
  "properties": {
    "metadata": {
      "$ref": "blueprint-common.schema.json#/$defs/Metadata"
    },
    "template": {
      "type": "object",
      "required": [
        "id",
        "version"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "version": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "gatewayRole": {
      "enum": [
        "GW-07"
      ]
    },
    "routes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "path",
          "method",
          "serviceOperation",
          "scope"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "serviceOperation": {
            "type": "string"
          },
          "rateLimitClass": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "auth": {
      "type": "object",
      "required": [
        "audience",
        "issuer"
      ],
      "properties": {
        "audience": {
          "type": "string"
        },
        "issuer": {
          "type": "string"
        },
        "tokenValidation": {
          "enum": [
            "canonical-adr-0101"
          ]
        }
      },
      "additionalProperties": false
    }
  }
}
