{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agla.local/schemas/five-class-deployment-traversal-profile.schema.json",
  "title": "AGLA Five-Class Deployment Traversal Profile Candidate",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "profile_id",
    "version",
    "status",
    "authority_effect",
    "scope",
    "deployment_families",
    "canonical_provider_sequence",
    "interface_input_path",
    "opera_reentry_path",
    "invocation_epoch_contract",
    "tenet_evidence_contract",
    "rotas_evidence_contract",
    "arepo_gate",
    "sator_return_contract",
    "cache_policy",
    "deferred_surfaces"
  ],
  "properties": {
    "profile_id": { "const": "AGLA.CHAT_AGENT.FIVE_CLASS_TRAVERSAL.V1" },
    "version": { "const": "1.0.0" },
    "status": { "const": "CANDIDATE / NON_RUNTIME / NO_AUTHORITY_EFFECT" },
    "authority_effect": { "const": "NONE" },
    "scope": { "const": "CHAT_AND_AGENT_DEPLOYMENT_TRAVERSAL" },
    "deployment_families": {
      "type": "array",
      "minItems": 3,
      "uniqueItems": true,
      "items": { "enum": ["CONTEXT_RICH_CHAT", "THIN_DEPLOYED_CHAT", "AGLA_AGENT_ECOSYSTEM"] }
    },
    "canonical_provider_sequence": { "$ref": "#/$defs/nonEmptyStringArray" },
    "interface_input_path": { "$ref": "#/$defs/nonEmptyStringArray" },
    "opera_reentry_path": { "$ref": "#/$defs/nonEmptyStringArray" },
    "invocation_epoch_contract": {
      "type": "object",
      "additionalProperties": false,
      "required": ["epoch_source", "renewal_events", "admission_scope"],
      "properties": {
        "epoch_source": { "type": "string", "minLength": 1 },
        "renewal_events": { "$ref": "#/$defs/nonEmptyStringArray" },
        "admission_scope": { "type": "string", "minLength": 1 }
      }
    },
    "tenet_evidence_contract": { "$ref": "#/$defs/evidenceContract" },
    "rotas_evidence_contract": { "$ref": "#/$defs/evidenceContract" },
    "arepo_gate": {
      "type": "object",
      "additionalProperties": false,
      "required": ["mode", "requires", "rejects"],
      "properties": {
        "mode": { "const": "FAIL_CLOSED" },
        "requires": { "$ref": "#/$defs/nonEmptyStringArray" },
        "rejects": { "$ref": "#/$defs/nonEmptyStringArray" }
      }
    },
    "sator_return_contract": {
      "type": "object",
      "additionalProperties": false,
      "required": ["must_expose", "cannot_retain_as_next_execution_authority"],
      "properties": {
        "must_expose": { "$ref": "#/$defs/nonEmptyStringArray" },
        "cannot_retain_as_next_execution_authority": { "const": true }
      }
    },
    "cache_policy": {
      "type": "object",
      "additionalProperties": false,
      "required": ["full_reparse_required_each_epoch", "reuse_requires", "reuse_forbidden_when"],
      "properties": {
        "full_reparse_required_each_epoch": { "const": false },
        "reuse_requires": { "$ref": "#/$defs/nonEmptyStringArray" },
        "reuse_forbidden_when": { "$ref": "#/$defs/nonEmptyStringArray" }
      }
    },
    "deferred_surfaces": {
      "type": "array",
      "minItems": 2,
      "uniqueItems": true,
      "items": { "enum": ["GENERAL_GRAPHUS_FORMALIZATION", "ROOT_CLASS_PATCH", "SYSTEM_INDEX_REGISTRATION", "RUNTIME_BINDING", "DEPLOYMENT_REGENERATION"] }
    }
  },
  "$defs": {
    "nonEmptyStringArray": {
      "type": "array",
      "minItems": 1,
      "items": { "type": "string", "minLength": 1 }
    },
    "evidenceContract": {
      "type": "object",
      "additionalProperties": false,
      "required": ["required_fields", "freshness_rule", "failure_state"],
      "properties": {
        "required_fields": { "$ref": "#/$defs/nonEmptyStringArray" },
        "freshness_rule": { "type": "string", "minLength": 1 },
        "failure_state": { "type": "string", "minLength": 1 }
      }
    }
  }
}
