{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://subodhkc.com/frameworks/csm/2.0/csm-2.0.schema.json",
  "title": "CSM 2.0 Specification",
  "description": "Deterministic-by-Design Governance Operating Model for AI Systems",
  "type": "object",
  "required": ["specVersion", "specDate", "domains", "components", "executionFunctions", "governanceContracts", "operationalMapping", "handoffContracts", "reassessmentTriggers", "componentDependencies", "provenance"],
  "properties": {
    "specVersion": { "type": "string", "const": "2.0.0" },
    "specDate": { "type": "string", "format": "date" },
    "changelog": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["version", "date", "label", "summary", "added", "unchanged"],
        "properties": {
          "version": { "type": "string" },
          "date": { "type": "string" },
          "label": { "type": "string" },
          "summary": { "type": "string" },
          "added": { "type": "array", "items": { "type": "string" } },
          "unchanged": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "domains": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "displayName", "shortName", "tagline", "centralQuestion", "componentIds"],
        "properties": {
          "id": { "type": "string", "enum": ["ENT", "PRJ", "CODE", "UX"] },
          "displayName": { "type": "string" },
          "shortName": { "type": "string" },
          "tagline": { "type": "string" },
          "centralQuestion": { "type": "string" },
          "componentIds": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "components": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "domain", "name", "description"],
        "properties": {
          "id": { "type": "string", "enum": ["ENT-POLICY","ENT-RISK","ENT-DATA","ENT-MANDATE","PRJ-BUSINESS","PRJ-TESTING","PRJ-SCALE","PRJ-PLAYBOOK","CODE-STANDARDS","CODE-SECURITY","CODE-HUMAN","CODE-TRACE","UX-IMPACT","UX-EXPLAIN","UX-CAPABILITY","UX-ADOPTION"] },
          "domain": { "type": "string", "enum": ["ENT", "PRJ", "CODE", "UX"] },
          "name": { "type": "string" },
          "description": { "type": "string" }
        }
      }
    },
    "executionFunctions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "name", "question", "description"],
        "properties": {
          "id": { "type": "string", "enum": ["EF1-PURPOSE","EF2-MAPPING","EF3-RISK","EF4-DELIVERY","EF5-OVERSIGHT","EF6-COMPLIANCE"] },
          "name": { "type": "string" },
          "question": { "type": "string" },
          "description": { "type": "string" }
        }
      }
    },
    "governanceContracts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "version", "domain", "name", "purpose", "coreQuestion", "applicability", "requiredInputs", "optionalInputs", "objectiveRules", "humanJudgmentPoints", "requiredDecisions", "requiredEvidence", "responsibleRoles", "accountableRole", "outputs", "blockingConditions", "allowedExceptions", "exceptionApproval", "handoffTargets", "handoffOutputs", "reassessmentTriggers", "executionFunctionMappings", "sourceProvenance", "dependencies"],
        "properties": {
          "id": { "type": "string" },
          "version": { "type": "string" },
          "domain": { "type": "string" },
          "name": { "type": "string" },
          "purpose": { "type": "string" },
          "coreQuestion": { "type": "string" },
          "applicability": { "type": "array" },
          "requiredInputs": { "type": "array" },
          "optionalInputs": { "type": "array" },
          "objectiveRules": { "type": "array" },
          "humanJudgmentPoints": { "type": "array" },
          "requiredDecisions": { "type": "array" },
          "requiredEvidence": { "type": "array" },
          "responsibleRoles": { "type": "array", "items": { "type": "string" } },
          "accountableRole": { "type": "string" },
          "outputs": { "type": "array", "items": { "type": "string" } },
          "blockingConditions": { "type": "array", "items": { "type": "string" } },
          "allowedExceptions": { "type": "object" },
          "exceptionApproval": { "type": "object" },
          "handoffTargets": { "type": "array" },
          "handoffOutputs": { "type": "array", "items": { "type": "string" } },
          "reassessmentTriggers": { "type": "array", "items": { "type": "string" } },
          "executionFunctionMappings": { "type": "array", "items": { "type": "string" } },
          "sourceProvenance": { "type": "string" },
          "dependencies": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "operationalMapping": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["componentId", "executionFunctionId", "relevance"],
        "properties": {
          "componentId": { "type": "string" },
          "executionFunctionId": { "type": "string" },
          "relevance": { "type": "string" }
        }
      }
    },
    "handoffContracts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "fromDomain", "toDomain", "name", "requiredFields", "description"],
        "properties": {
          "id": { "type": "string" },
          "fromDomain": { "type": "string" },
          "toDomain": { "type": "string" },
          "name": { "type": "string" },
          "requiredFields": { "type": "array", "items": { "type": "string" } },
          "description": { "type": "string" }
        }
      }
    },
    "reassessmentTriggers": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "label", "description", "affectedDomains", "affectedComponents"],
        "properties": {
          "id": { "type": "string" },
          "label": { "type": "string" },
          "description": { "type": "string" },
          "affectedDomains": { "type": "array", "items": { "type": "string" } },
          "affectedComponents": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "componentDependencies": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["component", "dependsOn", "rule"],
        "properties": {
          "component": { "type": "string" },
          "dependsOn": { "type": "string" },
          "rule": { "type": "string" }
        }
      }
    },
    "stateModel": {
      "type": "object",
      "required": ["requirementStates", "domainStates", "systemStates"],
      "properties": {
        "requirementStates": { "type": "object" },
        "domainStates": { "type": "object" },
        "systemStates": { "type": "object" }
      }
    },
    "governanceDepth": {
      "type": "object",
      "required": ["levels", "proportionalityFactors"],
      "properties": {
        "levels": { "type": "object" },
        "proportionalityFactors": { "type": "array" }
      }
    },
    "provenance": {
      "type": "object",
      "required": ["originalArticleTitle", "originalAuthor", "originalPublication", "originalPublicationDate", "sourceUrl", "v2SpecificationDate", "determinismPrinciple", "legalDisclaimer"],
      "properties": {
        "originalArticleTitle": { "type": "string" },
        "originalAuthor": { "type": "string" },
        "originalPublication": { "type": "string" },
        "originalPublicationDate": { "type": "string" },
        "sourceUrl": { "type": "string" },
        "v2SpecificationDate": { "type": "string" },
        "determinismPrinciple": { "type": "string" },
        "legalDisclaimer": { "type": "string" }
      }
    },
    "determinismBoundary": {
      "type": "object",
      "required": ["deterministicDecisions", "humanJudgmentDecisions", "forbiddenOutputStates", "forbiddenScoreNames"],
      "properties": {
        "deterministicDecisions": { "type": "array", "items": { "type": "string" } },
        "humanJudgmentDecisions": { "type": "array", "items": { "type": "string" } },
        "forbiddenOutputStates": { "type": "array", "items": { "type": "string" } },
        "forbiddenScoreNames": { "type": "array", "items": { "type": "string" } }
      }
    },
    "nistIsoCrosswalk": {
      "type": "object",
      "required": ["entries", "disclaimer"],
      "properties": {
        "entries": { "type": "array" },
        "disclaimer": { "type": "string" }
      }
    }
  }
}
