{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://titan.local/schemas/titan-capabilities-v28-candidate.schema.json",
  "title": "Titan v28 candidate registry",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "documentType",
    "status",
    "prepared",
    "basedOn",
    "candidatePolicy",
    "frozenCoreContract",
    "measurementStandard",
    "counts",
    "families",
    "modules",
    "governance",
    "adaptivePaths",
    "evidenceLedger",
    "researchObservatory",
    "explicitExclusions",
    "crossCandidatePromotionCriteria",
    "openEvidenceRequirements",
    "externalAnchorLedger"
  ],
  "properties": {
    "schemaVersion": {
      "const": "28.0-candidate.4"
    },
    "documentType": {
      "const": "titan-v28-candidate-registry"
    },
    "status": {
      "const": "candidate-not-promoted"
    },
    "prepared": {
      "type": "string",
      "format": "date"
    },
    "basedOn": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "operationalRegistry",
        "operationalSchemaVersion",
        "cockpitSchemaVersion",
        "engineVersion"
      ],
      "properties": {
        "operationalRegistry": {
          "const": "titan_capabilities_v27.json"
        },
        "operationalSchemaVersion": {
          "const": "27.3"
        },
        "cockpitSchemaVersion": {
          "const": "titan-cockpit/27.2.0"
        },
        "engineVersion": {
          "const": "1.5.0"
        }
      }
    },
    "candidatePolicy": {
      "type": "object",
      "required": [
        "scored",
        "availableForAssessment",
        "promotionRequired",
        "claimRule",
        "evidenceRule",
        "noGlobalScore"
      ],
      "properties": {
        "scored": {
          "const": false
        },
        "availableForAssessment": {
          "const": false
        },
        "promotionRequired": {
          "const": true
        },
        "claimRule": {
          "type": "string",
          "minLength": 1
        },
        "evidenceRule": {
          "type": "string",
          "minLength": 1
        },
        "noGlobalScore": {
          "const": true
        }
      }
    },
    "frozenCoreContract": {
      "type": "object",
      "required": [
        "preserved",
        "coreScoreVersion",
        "coreCalculationContract",
        "coreDomainCount",
        "equalLayerWeighting",
        "candidateEffectOnCore",
        "policy",
        "bridgeRulesVersion"
      ],
      "properties": {
        "preserved": {
          "const": true
        },
        "coreScoreVersion": {
          "const": "25.0"
        },
        "coreCalculationContract": {
          "const": "1.2"
        },
        "coreDomainCount": {
          "const": 24
        },
        "equalLayerWeighting": {
          "const": true
        },
        "candidateEffectOnCore": {
          "const": "none"
        },
        "policy": {
          "type": "string",
          "minLength": 1
        },
        "bridgeRulesVersion": {
          "const": "1.3"
        }
      }
    },
    "measurementStandard": {
      "type": "object"
    },
    "counts": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "familiesIfPromoted",
        "operationalModules",
        "candidateModules",
        "modulesIfPromoted",
        "governanceControls",
        "evidenceEntries",
        "observatoryEntries"
      ],
      "properties": {
        "familiesIfPromoted": {
          "const": 8
        },
        "operationalModules": {
          "const": 16
        },
        "candidateModules": {
          "const": 7
        },
        "modulesIfPromoted": {
          "const": 23
        },
        "governanceControls": {
          "type": "integer",
          "minimum": 5
        },
        "evidenceEntries": {
          "const": 67
        },
        "observatoryEntries": {
          "const": 14
        }
      }
    },
    "families": {
      "type": "array",
      "minItems": 8,
      "maxItems": 8,
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "purpose",
          "exclusions",
          "status",
          "operationalModuleIds",
          "candidateModuleIds",
          "moduleIds"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^CAP-"
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "purpose": {
            "type": "string",
            "minLength": 1
          },
          "exclusions": {
            "type": "string",
            "minLength": 1
          },
          "status": {
            "enum": [
              "operational",
              "operational-with-candidates",
              "candidate"
            ]
          },
          "operationalModuleIds": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^MOD-"
            }
          },
          "candidateModuleIds": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^MOD-"
            }
          },
          "moduleIds": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "pattern": "^MOD-"
            }
          }
        }
      }
    },
    "modules": {
      "type": "array",
      "minItems": 23,
      "maxItems": 23,
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/operationalModule"
          },
          {
            "$ref": "#/$defs/candidateModule"
          }
        ]
      },
      "allOf": [
        {
          "contains": {
            "$ref": "#/$defs/operationalModule"
          },
          "minContains": 16,
          "maxContains": 16
        },
        {
          "contains": {
            "$ref": "#/$defs/candidateModule"
          },
          "minContains": 7,
          "maxContains": 7
        }
      ]
    },
    "governance": {
      "type": "array",
      "minItems": 5
    },
    "adaptivePaths": {
      "type": "array",
      "minItems": 1
    },
    "evidenceLedger": {
      "type": "array",
      "minItems": 67,
      "maxItems": 67,
      "items": {
        "$ref": "#/$defs/evidence"
      }
    },
    "researchObservatory": {
      "type": "array",
      "minItems": 14,
      "maxItems": 14
    },
    "explicitExclusions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "crossCandidatePromotionCriteria": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "openEvidenceRequirements": {
      "type": "array",
      "minItems": 7,
      "items": {
        "type": "object",
        "required": [
          "moduleId",
          "requirements"
        ],
        "properties": {
          "moduleId": {
            "type": "string",
            "pattern": "^MOD-"
          },
          "requirements": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      }
    },
    "externalAnchorLedger": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "documentType",
        "schemaVersion",
        "status",
        "prepared",
        "verificationTaxonomy",
        "policy",
        "anchors",
        "sourceVerification"
      ],
      "properties": {
        "documentType": {
          "const": "titan-external-anchor-ledger"
        },
        "schemaVersion": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "const": "candidate"
        },
        "prepared": {
          "type": "string",
          "format": "date"
        },
        "verificationTaxonomy": {
          "type": "array",
          "minItems": 5,
          "maxItems": 5,
          "uniqueItems": true,
          "items": {
            "type": "string"
          }
        },
        "policy": {
          "type": "object"
        },
        "anchors": {
          "type": "array",
          "minItems": 14,
          "maxItems": 14,
          "items": {
            "type": "object",
            "required": [
              "id",
              "moduleIds",
              "authority",
              "assessment",
              "evidenceModeMinimum",
              "countsForLevel",
              "jurisdiction",
              "expiryRecency",
              "verificationMethod",
              "limitations",
              "url",
              "status"
            ]
          }
        },
        "sourceVerification": {
          "type": "array",
          "minItems": 15,
          "maxItems": 15
        }
      }
    }
  },
  "$defs": {
    "measures": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "direct",
        "retention",
        "transfer",
        "burden"
      ],
      "properties": {
        "direct": {
          "type": "string",
          "minLength": 1
        },
        "retention": {
          "type": "string",
          "minLength": 1
        },
        "transfer": {
          "type": "string",
          "minLength": 1
        },
        "burden": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "anchors": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "1",
        "2",
        "3",
        "4",
        "5"
      ],
      "properties": {
        "1": {
          "type": "string",
          "minLength": 1
        },
        "2": {
          "type": "string",
          "minLength": 1
        },
        "3": {
          "type": "string",
          "minLength": 1
        },
        "4": {
          "type": "string",
          "minLength": 1
        },
        "5": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "operationalModule": {
      "type": "object",
      "required": [
        "id",
        "familyId",
        "name",
        "status",
        "scope",
        "measures",
        "anchors",
        "guardrail",
        "evidenceIds",
        "registryStatus",
        "scoreable",
        "availableForAssessment"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^MOD-"
        },
        "familyId": {
          "type": "string",
          "pattern": "^CAP-"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "continued",
            "new",
            "promoted"
          ]
        },
        "scope": {
          "type": "string",
          "minLength": 1
        },
        "measures": {
          "$ref": "#/$defs/measures"
        },
        "anchors": {
          "$ref": "#/$defs/anchors"
        },
        "guardrail": {
          "type": "string",
          "minLength": 1
        },
        "evidenceIds": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "pattern": "^EVD-"
          }
        },
        "registryStatus": {
          "const": "operational"
        },
        "scoreable": {
          "const": true
        },
        "availableForAssessment": {
          "const": true
        }
      }
    },
    "candidateModule": {
      "type": "object",
      "required": [
        "id",
        "familyId",
        "name",
        "status",
        "promotionStatus",
        "evidenceGrade",
        "risk",
        "scope",
        "exclusions",
        "measures",
        "decisionRules",
        "protocol",
        "anchors",
        "reviewWindowDays",
        "guardrails",
        "promotionGates",
        "evidenceIds",
        "registryStatus",
        "scoreable",
        "availableForAssessment"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^MOD-"
        },
        "familyId": {
          "type": "string",
          "pattern": "^CAP-"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "const": "candidate"
        },
        "promotionStatus": {
          "const": "not-promoted"
        },
        "evidenceGrade": {
          "enum": [
            "Strong",
            "Moderate",
            "Emerging"
          ]
        },
        "risk": {
          "type": "string",
          "minLength": 1
        },
        "scope": {
          "type": "string",
          "minLength": 1
        },
        "exclusions": {
          "type": "string",
          "minLength": 1
        },
        "measures": {
          "$ref": "#/$defs/measures"
        },
        "decisionRules": {
          "type": "object"
        },
        "protocol": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "anchors": {
          "$ref": "#/$defs/anchors"
        },
        "reviewWindowDays": {
          "type": "integer",
          "minimum": 1
        },
        "guardrails": {
          "type": "object",
          "required": [
            "safety",
            "clinical",
            "jurisdiction",
            "accessibility"
          ],
          "properties": {
            "safety": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "clinical": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "jurisdiction": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "accessibility": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        "promotionGates": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "evidenceIds": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "pattern": "^EVD-"
          }
        },
        "registryStatus": {
          "const": "candidate"
        },
        "scoreable": {
          "const": false
        },
        "availableForAssessment": {
          "const": false
        }
      }
    },
    "evidence": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "title",
        "source",
        "year",
        "grade",
        "claim",
        "limits",
        "url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^EVD-"
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "source": {
          "type": "string",
          "minLength": 1
        },
        "year": {
          "type": "integer",
          "minimum": 1900,
          "maximum": 2100
        },
        "grade": {
          "enum": [
            "Strong",
            "Moderate",
            "Emerging",
            "Framework"
          ]
        },
        "claim": {
          "type": "string",
          "minLength": 1
        },
        "limits": {
          "type": "string",
          "minLength": 1
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}
