{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rodgui.github.io/ai-agent-governance-framework/schemas/control-catalog.schema.json",
  "title": "AI Governance Control Catalog Schema 2.0",
  "description": "Catálogo versionado de controls, implementação, evidências e métricas.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "catalogVersion",
    "title",
    "lastReviewed",
    "controls"
  ],
  "properties": {
    "schemaVersion": {
      "const": "2.0"
    },
    "catalogVersion": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?$"
    },
    "title": {
      "type": "string",
      "minLength": 3
    },
    "lastReviewed": {
      "type": "string",
      "format": "date"
    },
    "controls": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/control"
      }
    }
  },
  "$defs": {
    "control": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "title",
        "domain",
        "type",
        "statement",
        "rationale",
        "ownerRole",
        "appliesToTiers",
        "implementation",
        "evidence",
        "metrics",
        "scope",
        "verification",
        "blocking",
        "automation",
        "frameworkMappings"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^AGF-[A-Z]{3,5}-[0-9]{3}$"
        },
        "title": {
          "type": "string",
          "minLength": 3,
          "maxLength": 160
        },
        "domain": {
          "enum": [
            "organization",
            "registry",
            "lifecycle",
            "identity",
            "data",
            "tools",
            "model",
            "security",
            "risk",
            "responsible-ai",
            "evaluation",
            "audit",
            "operations",
            "adoption",
            "value"
          ]
        },
        "type": {
          "type": "array",
          "minItems": 1,
          "items": {
            "enum": [
              "preventive",
              "detective",
              "responsive",
              "corrective"
            ]
          },
          "uniqueItems": true
        },
        "statement": {
          "type": "string",
          "minLength": 20
        },
        "rationale": {
          "type": "string",
          "minLength": 20
        },
        "ownerRole": {
          "type": "string",
          "minLength": 2
        },
        "appliesToTiers": {
          "type": "array",
          "minItems": 1,
          "items": {
            "enum": [
              "T1",
              "T2",
              "T3",
              "T4"
            ]
          },
          "uniqueItems": true
        },
        "implementation": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 5
          }
        },
        "evidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 3
          }
        },
        "metrics": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 3
          }
        },
        "automation": {
          "enum": [
            "manual",
            "assisted",
            "automated",
            "mixed"
          ]
        },
        "frameworkMappings": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "framework",
              "reference"
            ],
            "properties": {
              "framework": {
                "type": "string"
              },
              "reference": {
                "type": "string"
              },
              "notes": {
                "type": "string"
              }
            }
          }
        },
        "scope": {
          "description": "organization: satisfeito uma vez para a organização. agent: avaliado por agente ou release.",
          "enum": [
            "organization",
            "agent"
          ]
        },
        "verification": {
          "description": "Testes objetivos que decidem se o control passa. Nome de artefato não é critério de aprovação.",
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 15
          }
        },
        "blocking": {
          "description": "Reprovação impede release ou continuidade em produção.",
          "type": "boolean"
        }
      }
    }
  }
}
