{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aips.kivanura.org/spec/aips/pmdd/0.1/aips-pmdd-0.1.schema.json",
  "title": "AIPS PMDD 0.1 Maturity Assessment",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "@context",
    "@type",
    "assessmentId",
    "productVersionRef",
    "productFamily",
    "aiQualificationStatus",
    "aiQualificationRef",
    "governanceProfileRef",
    "assessedAt",
    "characteristics",
    "scorePercent",
    "maturityLevel",
    "productionReadiness"
  ],
  "properties": {
    "@context": {},
    "@type": {
      "const": "PMDDMaturityAssessment"
    },
    "assessmentId": {
      "type": "string",
      "minLength": 1
    },
    "productVersionRef": {
      "type": "string",
      "minLength": 1
    },
    "productFamily": {
      "const": "AIProduct"
    },
    "aiQualificationStatus": {
      "const": "CURRENT"
    },
    "aiQualificationRef": {
      "type": "string",
      "minLength": 1
    },
    "governanceProfileRef": {
      "type": "string",
      "minLength": 1
    },
    "assessedAt": {
      "type": "string",
      "format": "date-time"
    },
    "characteristics": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "AIPCH01",
        "AIPCH02",
        "AIPCH03",
        "AIPCH04",
        "AIPCH05",
        "AIPCH06",
        "AIPCH07",
        "AIPCH08",
        "AIPCH09",
        "AIPCH10",
        "AIPCH11",
        "AIPCH12",
        "AIPCH13",
        "AIPCH14",
        "AIPCH15",
        "AIPCH16",
        "AIPCH17",
        "AIPCH18",
        "AIPCH19",
        "AIPCH20",
        "AIPCH21"
      ],
      "properties": {
        "AIPCH01": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH02": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH03": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH04": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH05": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH06": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH07": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH08": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH09": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH10": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH11": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH12": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH13": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH14": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH15": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH16": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH17": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH18": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH19": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH20": {
          "$ref": "#/$defs/CharacteristicAssessment"
        },
        "AIPCH21": {
          "$ref": "#/$defs/CharacteristicAssessment"
        }
      }
    },
    "scorePercent": {
      "type": "number",
      "minimum": 0,
      "maximum": 100
    },
    "maturityLevel": {
      "type": "string",
      "enum": [
        "L0_EMERGING",
        "L1_EVOLVING",
        "L2_HIGH_MATURITY"
      ]
    },
    "productionReadiness": {
      "type": "string",
      "enum": [
        "READY",
        "CONDITIONAL",
        "NOT_READY"
      ]
    },
    "governanceBlockers": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "notes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "CharacteristicAssessment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "weight",
        "evidence"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "MET",
            "PARTIAL",
            "NOT_MET",
            "NOT_APPLICABLE"
          ]
        },
        "weight": {
          "type": "number",
          "minimum": 0
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "status": {
                "const": "NOT_APPLICABLE"
              }
            },
            "required": [
              "status"
            ]
          },
          "then": {
            "required": [
              "rationale"
            ]
          }
        }
      ]
    }
  }
}
