{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.connectsoft.ai/reference/schemas/blueprint-backend-library.schema.json",
  "title": "Backend Library Blueprint (blueprint-backend-library-v1)",
  "description": "Descriptor document of the Backend Library 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",
    "layer",
    "area",
    "publicSurface",
    "packages"
  ],
  "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
    },
    "layer": {
      "enum": [
        "L1",
        "L2",
        "L3"
      ]
    },
    "area": {
      "type": "string"
    },
    "publicSurface": {
      "type": "object",
      "required": [
        "namespaces"
      ],
      "properties": {
        "namespaces": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "optionsSections": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "registrationApi": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "packages": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "targets": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      }
    }
  }
}
