{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paloframework.org/schemas/palo-data-fitness-decision.schema.json",
  "title": "PALO Data Fitness Decision",
  "description": "Immutable decision binding one subject, purpose, policy version and exact external evidence references.",
  "type": "object",
  "required": ["format", "schemaVersion", "decisionId", "tenantId", "subject", "purpose", "policyId", "policyVersion", "status", "checks", "evidenceRefs", "evidenceDigest", "decidedAt", "expiresAt"],
  "properties": {
    "format": { "const": "palo-data-fitness-decision" },
    "schemaVersion": { "const": "1.0.0" },
    "decisionId": { "type": "string", "pattern": "^fitness-decision-[a-f0-9-]{36}$" },
    "tenantId": { "type": "string", "minLength": 1, "maxLength": 128 },
    "subject": {
      "type": "object",
      "required": ["type", "id"],
      "properties": {
        "type": { "enum": ["dataset", "data-product", "model", "ai-system", "agent", "tool", "access-entitlement", "other"] },
        "id": { "type": "string", "minLength": 1, "maxLength": 1000 }
      },
      "additionalProperties": false
    },
    "purpose": { "type": "string", "minLength": 1, "maxLength": 300 },
    "policyId": { "type": "string", "pattern": "^fitness-policy-[a-zA-Z0-9][a-zA-Z0-9._-]{2,100}$" },
    "policyVersion": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
    "status": { "enum": ["allowed", "denied", "review_required"] },
    "checks": {
      "type": "array",
      "minItems": 1,
      "maxItems": 200,
      "items": {
        "type": "object",
        "required": ["checkId", "status", "reason", "evidenceRefIds"],
        "properties": {
          "checkId": { "type": "string", "pattern": "^fitness-check-[a-zA-Z0-9._-]{1,100}$" },
          "status": { "enum": ["pass", "fail", "unknown"] },
          "reason": { "type": "string", "minLength": 1, "maxLength": 1000 },
          "evidenceRefIds": { "type": "array", "uniqueItems": true, "items": { "type": "string", "pattern": "^evidence-ref-[a-f0-9-]{36}$" } }
        },
        "additionalProperties": false
      }
    },
    "evidenceRefs": { "type": "array", "uniqueItems": true, "items": { "type": "string", "pattern": "^evidence-ref-[a-f0-9-]{36}$" } },
    "evidenceDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
    "decidedAt": { "type": "string", "format": "date-time" },
    "expiresAt": { "type": "string", "format": "date-time" }
  },
  "additionalProperties": false
}
