{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.connectsoft.ai/reference/schemas/blueprint-common.schema.json",
  "title": "Blueprint common metadata (blueprint-common-v1)",
  "description": "Metadata every blueprint document carries (BC-02). Validated by BlueprintService before the kind-specific schema.",
  "$defs": {
    "Metadata": {
      "type": "object",
      "required": [
        "blueprintId",
        "kind",
        "version",
        "schemaVersion",
        "projectId",
        "title",
        "status",
        "authoredBy"
      ],
      "properties": {
        "blueprintId": {
          "type": "string",
          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
        },
        "kind": {
          "type": "string"
        },
        "version": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$"
        },
        "schemaVersion": {
          "type": "string"
        },
        "projectId": {
          "type": "string"
        },
        "tenantId": {
          "type": "string",
          "description": "Trusted; set by the backend from the execution scope."
        },
        "title": {
          "type": "string",
          "maxLength": 200
        },
        "summary": {
          "type": "string",
          "maxLength": 2000
        },
        "status": {
          "enum": [
            "Draft",
            "Validated",
            "Submitted",
            "Published",
            "Deprecated"
          ]
        },
        "authoredBy": {
          "type": "object",
          "required": [
            "kind",
            "id"
          ],
          "properties": {
            "kind": {
              "enum": [
                "user",
                "run"
              ]
            },
            "id": {
              "type": "string"
            },
            "agentReleaseId": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "dslRefs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "ref"
            ],
            "properties": {
              "ref": {
                "type": "string"
              },
              "hash": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "dependsOn": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "blueprintId",
              "version"
            ],
            "properties": {
              "blueprintId": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "traceability": {
          "type": "object",
          "required": [],
          "properties": {
            "fr": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "fux": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "nfr": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "xl": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "Persona": {
      "type": "object",
      "required": [
        "id",
        "name",
        "role"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "goals": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "painPoints": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "Metric": {
      "type": "object",
      "required": [
        "id",
        "name",
        "target"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "target": {
          "type": "string"
        },
        "window": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "Classification": {
      "enum": [
        "public",
        "internal",
        "confidential",
        "restricted"
      ]
    },
    "SideEffectClass": {
      "enum": [
        "read",
        "sandbox",
        "shared-write",
        "external",
        "production",
        "publication",
        "spend"
      ]
    }
  }
}
