{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rodgui.github.io/ai-agent-governance-framework/schemas/model-provider-catalog.schema.json",
  "title": "Approved Model and Provider Catalog",
  "description": "Combinações aprovadas de provider, model, versão, finalidade, dados, região, avaliação e estratégia de saída.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "catalogVersion",
    "title",
    "owner",
    "lastReviewed",
    "entries"
  ],
  "properties": {
    "schemaVersion": {
      "const": "1.0"
    },
    "catalogVersion": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?$"
    },
    "title": {
      "type": "string",
      "minLength": 3
    },
    "owner": {
      "type": "string",
      "minLength": 3
    },
    "lastReviewed": {
      "type": "string",
      "format": "date"
    },
    "entries": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/entry"
      }
    }
  },
  "$defs": {
    "entry": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "provider",
        "modelId",
        "modelVersion",
        "purpose",
        "hosting",
        "status",
        "versionPinned",
        "dataUse",
        "allowedDataClasses",
        "allowedRegions",
        "allowedRiskTiers",
        "evaluationRef",
        "reviewExpiresAt",
        "exitStrategy"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^MPC-[A-Z0-9-]{3,80}$"
        },
        "provider": {
          "type": "string",
          "minLength": 2
        },
        "modelId": {
          "type": "string",
          "minLength": 2
        },
        "modelVersion": {
          "type": "string",
          "minLength": 1
        },
        "purpose": {
          "type": "string",
          "minLength": 10
        },
        "hosting": {
          "enum": [
            "saas",
            "managed",
            "self-hosted",
            "on-device"
          ]
        },
        "status": {
          "enum": [
            "approved",
            "conditional",
            "deprecated",
            "blocked"
          ]
        },
        "versionPinned": {
          "type": "boolean"
        },
        "dataUse": {
          "enum": [
            "no-training",
            "contract-defined",
            "unknown"
          ]
        },
        "allowedDataClasses": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "enum": [
              "public",
              "internal",
              "confidential",
              "restricted",
              "regulated"
            ]
          }
        },
        "allowedRegions": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 2
          }
        },
        "allowedRiskTiers": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "enum": [
              "T1",
              "T2",
              "T3",
              "T4"
            ]
          }
        },
        "evaluationRef": {
          "type": "string",
          "minLength": 3
        },
        "conditionRefs": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 3
          }
        },
        "changeDetectionRef": {
          "type": "string",
          "minLength": 3
        },
        "reviewExpiresAt": {
          "type": "string",
          "format": "date"
        },
        "exitStrategy": {
          "type": "string",
          "minLength": 10
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 3
          }
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "status": {
                "const": "conditional"
              }
            },
            "required": [
              "status"
            ]
          },
          "then": {
            "required": [
              "conditionRefs"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "versionPinned": {
                "const": false
              }
            },
            "required": [
              "versionPinned"
            ]
          },
          "then": {
            "required": [
              "changeDetectionRef"
            ]
          }
        }
      ]
    }
  }
}
