{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mirmcsolutionweb.com/.well-known/mirmc-product-studio-evidence-passport.schema.json",
  "title": "MIRMC Product Studio Evidence Passport v1.1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "version",
    "status",
    "reasons",
    "organizationId",
    "correlationId",
    "chainHead",
    "lineageCommitSha",
    "runtimeCommitSha",
    "runtimeIdentityHash",
    "databaseVerified",
    "checkedAt",
    "latestEvidenceAt",
    "evidenceAgeMinutes",
    "freshness",
    "grantsAuthority",
    "canPublishByPassportAlone",
    "canDeployByPassportAlone",
    "evidenceCanBypassFourEyes"
  ],
  "properties": {
    "version": { "const": "1.1.0" },
    "status": { "type": "string", "enum": ["verified", "partial", "unverified"] },
    "reasons": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "NO_EVIDENCE",
          "LINEAGE_INCOMPLETE",
          "HASH_CHAIN_CONTINUITY_FAILED",
          "CANONICAL_STAGE_ORDER_FAILED",
          "DATABASE_VERIFICATION_INCOMPLETE",
          "RUNTIME_IDENTITY_INCOMPLETE",
          "COMMIT_RUNTIME_MISMATCH"
        ]
      }
    },
    "organizationId": { "type": ["string", "null"], "format": "uuid" },
    "correlationId": { "type": ["string", "null"], "format": "uuid" },
    "chainHead": { "type": ["string", "null"], "pattern": "^[0-9a-f]{64}$" },
    "lineageCommitSha": { "type": ["string", "null"], "pattern": "^[0-9a-f]{40}$" },
    "runtimeCommitSha": { "type": ["string", "null"], "pattern": "^[0-9a-f]{40}$" },
    "runtimeIdentityHash": { "type": ["string", "null"], "pattern": "^[0-9a-f]{64}$" },
    "databaseVerified": { "type": "boolean" },
    "checkedAt": { "type": "string", "format": "date-time" },
    "latestEvidenceAt": { "type": ["string", "null"], "format": "date-time" },
    "evidenceAgeMinutes": { "type": ["integer", "null"], "minimum": 0 },
    "freshness": { "type": "string", "enum": ["current", "aging", "historic", "unknown"] },
    "grantsAuthority": { "const": false },
    "canPublishByPassportAlone": { "const": false },
    "canDeployByPassportAlone": { "const": false },
    "evidenceCanBypassFourEyes": { "const": false }
  },
  "allOf": [
    {
      "if": { "properties": { "status": { "const": "verified" } }, "required": ["status"] },
      "then": {
        "properties": {
          "reasons": { "maxItems": 0 },
          "organizationId": { "type": "string", "format": "uuid" },
          "correlationId": { "type": "string", "format": "uuid" },
          "chainHead": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
          "lineageCommitSha": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
          "runtimeCommitSha": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
          "runtimeIdentityHash": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
          "databaseVerified": { "const": true }
        }
      }
    }
  ]
}
