{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/foo-log-inc/artifact-contracts/schemas/2026A.json",
  "title": "Artifact Contracts Document",
  "description": "Schema for artifact-contracts.yaml — declarative artifact registry definitions.",
  "version": "2026A",
  "$ref": "#/definitions/ArtifactContractsDocument",
  "definitions": {
    "ArtifactContractsDocument": {
      "type": "object",
      "properties": {
        "artifact_contracts": {
          "type": "string",
          "minLength": 1
        },
        "system": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "additionalProperties": false
        },
        "artifacts": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "minLength": 1
              },
              "description": {
                "type": "string"
              },
              "authority": {
                "type": "string",
                "enum": [
                  "canonical",
                  "derived",
                  "generated",
                  "control"
                ]
              },
              "path_patterns": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "minItems": 1
              },
              "exclude_patterns": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "manual_edit": {
                "type": "string",
                "enum": [
                  "allowed",
                  "discouraged",
                  "forbidden"
                ]
              },
              "change_control": {
                "type": "string",
                "enum": [
                  "none",
                  "approval-required",
                  "regeneration-required"
                ]
              },
              "visibility": {
                "type": "string",
                "enum": [
                  "public",
                  "internal",
                  "private"
                ]
              },
              "states": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "authority",
              "path_patterns"
            ],
            "additionalProperties": true
          }
        }
      },
      "required": [
        "artifact_contracts",
        "system",
        "artifacts"
      ],
      "additionalProperties": false
    }
  }
}
