{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:musyg:ai-adoption-playbook:control-crosswalk-schema:1.1.0",
  "title": "AI Adoption Playbook control crosswalk",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "catalog_version",
    "published_on",
    "status",
    "scope",
    "limitations",
    "axes",
    "use_pattern_profiles",
    "sources",
    "evidence_types",
    "controls"
  ],
  "properties": {
    "$schema": { "type": "string" },
    "schema_version": { "const": "1.1.0" },
    "catalog_version": { "type": "string", "pattern": "^[0-9]{4}\\.[0-9]{2}$" },
    "published_on": { "type": "string", "format": "date" },
    "status": { "enum": ["maintained_internal_crosswalk"] },
    "scope": { "$ref": "#/$defs/localizedText" },
    "limitations": { "$ref": "#/$defs/localizedText" },
    "axes": {
      "type": "object",
      "additionalProperties": false,
      "required": ["organization_types", "risk_levels", "autonomy_levels", "use_patterns", "jurisdictions", "gates", "lifecycle_phases"],
      "properties": {
        "organization_types": {
          "type": "array",
          "items": { "enum": ["independent", "tpe", "pme", "nonprofit", "public"] },
          "uniqueItems": true
        },
        "risk_levels": {
          "type": "array",
          "items": { "enum": ["R0", "R1", "R2", "R3"] },
          "uniqueItems": true
        },
        "autonomy_levels": {
          "type": "array",
          "items": { "enum": ["A0", "A1", "A2", "A3", "A4"] },
          "uniqueItems": true
        },
        "use_patterns": {
          "type": "array",
          "items": { "enum": ["generation", "retrieval", "classification", "prediction", "conversation", "multimodal", "agentic"] },
          "uniqueItems": true
        },
        "jurisdictions": {
          "type": "array",
          "items": { "enum": ["CH", "EU"] },
          "uniqueItems": true
        },
        "gates": {
          "type": "array",
          "items": { "enum": ["G1", "G2", "G3", "G4", "G5", "P0", "P1", "P2", "P3", "P4", "P5"] },
          "uniqueItems": true
        },
        "lifecycle_phases": {
          "type": "array",
          "items": { "type": "integer", "minimum": 0, "maximum": 11 },
          "uniqueItems": true
        }
      }
    },
    "use_pattern_profiles": {
      "type": "array",
      "minItems": 7,
      "items": { "$ref": "#/$defs/usePatternProfile" }
    },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/source" }
    },
    "evidence_types": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/evidenceType" }
    },
    "controls": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/control" }
    }
  },
  "$defs": {
    "localizedText": {
      "type": "object",
      "additionalProperties": false,
      "required": ["en", "fr"],
      "properties": {
        "en": { "type": "string", "minLength": 1 },
        "fr": { "type": "string", "minLength": 1 }
      }
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": ["source_id", "title", "publisher", "version", "status", "url", "checked_on", "use_boundary"],
      "properties": {
        "source_id": { "type": "string", "pattern": "^[A-Z0-9][A-Z0-9-]+$" },
        "title": { "type": "string", "minLength": 1 },
        "publisher": { "type": "string", "minLength": 1 },
        "version": { "type": "string", "minLength": 1 },
        "status": { "enum": ["internal_method", "published_standard", "voluntary_framework", "official_guidance", "community_guidance"] },
        "url": { "type": "string", "format": "uri" },
        "checked_on": { "type": "string", "format": "date" },
        "use_boundary": { "$ref": "#/$defs/localizedText" }
      }
    },
    "usePatternProfile": {
      "type": "object",
      "additionalProperties": false,
      "required": ["use_pattern_id", "name", "task", "evaluation_focus", "threat_focus"],
      "properties": {
        "use_pattern_id": { "enum": ["generation", "retrieval", "classification", "prediction", "conversation", "multimodal", "agentic"] },
        "name": { "$ref": "#/$defs/localizedText" },
        "task": { "$ref": "#/$defs/localizedText" },
        "evaluation_focus": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 },
          "uniqueItems": true
        },
        "threat_focus": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 },
          "uniqueItems": true
        }
      }
    },
    "evidenceType": {
      "type": "object",
      "additionalProperties": false,
      "required": ["evidence_id", "name", "minimum_record", "template"],
      "properties": {
        "evidence_id": { "type": "string", "pattern": "^EV-[A-Z0-9-]+$" },
        "name": { "$ref": "#/$defs/localizedText" },
        "minimum_record": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 },
          "uniqueItems": true
        },
        "template": { "type": ["string", "null"] }
      }
    },
    "sourceRef": {
      "type": "object",
      "additionalProperties": false,
      "required": ["source_id", "relation"],
      "properties": {
        "source_id": { "type": "string" },
        "relation": { "enum": ["direct", "supports", "contextual"] }
      }
    },
    "applicability": {
      "type": "object",
      "additionalProperties": false,
      "required": ["organization_types", "risk_levels", "autonomy_levels", "conditions"],
      "properties": {
        "organization_types": {
          "type": "array",
          "minItems": 1,
          "items": { "enum": ["independent", "tpe", "pme", "nonprofit", "public"] },
          "uniqueItems": true
        },
        "risk_levels": {
          "type": "array",
          "minItems": 1,
          "items": { "enum": ["R0", "R1", "R2", "R3"] },
          "uniqueItems": true
        },
        "autonomy_levels": {
          "type": "array",
          "minItems": 1,
          "items": { "enum": ["A0", "A1", "A2", "A3", "A4"] },
          "uniqueItems": true
        },
        "use_patterns": {
          "type": "array",
          "minItems": 1,
          "items": { "enum": ["generation", "retrieval", "classification", "prediction", "conversation", "multimodal", "agentic"] },
          "uniqueItems": true
        },
        "jurisdictions": {
          "type": "array",
          "minItems": 1,
          "items": { "enum": ["CH", "EU"] },
          "uniqueItems": true
        },
        "conditions": {
          "type": "array",
          "items": {
            "enum": [
              "always",
              "external_provider",
              "personal_or_confidential_data",
              "external_content_or_tools",
              "external_or_irreversible_action",
              "material_human_impact",
              "mission_population",
              "public_authority",
              "public_procurement",
              "interactive_ai",
              "synthetic_content",
              "automated_individual_decision",
              "article50_transparency_scope",
              "model_customization",
              "software_or_code_effect"
            ]
          },
          "uniqueItems": true
        }
      }
    },
    "control": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "control_id",
        "family",
        "priority",
        "title",
        "objective",
        "applicability",
        "lifecycle_phases",
        "gates",
        "evidence_ids",
        "source_refs",
        "implementation_refs"
      ],
      "properties": {
        "control_id": { "type": "string", "pattern": "^AAP-[A-Z]{3}-[0-9]{3}$" },
        "family": {
          "enum": [
            "governance",
            "value",
            "risk",
            "data",
            "procurement",
            "evaluation",
            "security",
            "autonomy",
            "human_oversight",
            "traceability",
            "operations",
            "monitoring",
            "retirement",
            "mission",
            "public_governance",
            "transparency"
          ]
        },
        "priority": { "enum": ["baseline", "strengthened", "critical"] },
        "title": { "$ref": "#/$defs/localizedText" },
        "objective": { "$ref": "#/$defs/localizedText" },
        "applicability": { "$ref": "#/$defs/applicability" },
        "lifecycle_phases": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "integer", "minimum": 0, "maximum": 11 },
          "uniqueItems": true
        },
        "gates": {
          "type": "array",
          "minItems": 1,
          "items": { "enum": ["G1", "G2", "G3", "G4", "G5", "P0", "P1", "P2", "P3", "P4", "P5"] },
          "uniqueItems": true
        },
        "evidence_ids": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "pattern": "^EV-[A-Z0-9-]+$" },
          "uniqueItems": true
        },
        "source_refs": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/sourceRef" }
        },
        "implementation_refs": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 },
          "uniqueItems": true
        }
      }
    }
  }
}
