{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://dpone.dev/schemas/schema-migration/evidence-registry-record.schema.json",
  "title": "dpone schema migration evidence registry record",
  "type": "object",
  "required": [
    "schema_version",
    "record_id",
    "recorded_at",
    "target",
    "environment",
    "stage",
    "pack_id",
    "bundle_id",
    "status",
    "artifact_refs",
    "blockers",
    "warnings"
  ],
  "additionalProperties": true,
  "properties": {
    "schema_version": {"const": "dpone.schema_migration_evidence_registry_record.v1"},
    "record_id": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"},
    "recorded_at": {"type": "string"},
    "target": {
      "type": "object",
      "required": ["sink_type", "table"],
      "additionalProperties": true,
      "properties": {
        "sink_type": {"type": "string"},
        "table": {"type": "string"}
      }
    },
    "environment": {"type": "string", "minLength": 1},
    "stage": {
      "enum": [
        "planned",
        "reviewed",
        "approved",
        "certified",
        "contract_published",
        "contract_checked",
        "contract_gate_passed",
        "consumer_gate_passed",
        "consumer_certified",
        "adoption_planned",
        "consumer_migrating",
        "consumer_migrated",
        "policy_evaluated",
        "waiver_requested",
        "waiver_approved",
        "waiver_expired",
        "policy_gate_passed",
        "governance_export_planned",
        "governance_payload_rendered",
        "governance_published",
        "governance_publish_verified",
        "authority_registered",
        "authority_checked",
        "approval_quorum_verified",
        "evidence_signed",
        "evidence_signature_verified",
        "authority_gate_passed",
        "compatibility_view_planned",
        "compatibility_view_served",
        "contract_retirement_ready",
        "contract_retired",
        "compatibility_view_retired",
        "promoted",
        "applied",
        "verified",
        "watched",
        "backup_planned",
        "backup_created",
        "restore_rehearsed",
        "backup_certified",
        "recovery_point_recorded",
        "recovery_chain_verified",
        "recovery_restore_rehearsed",
        "closed",
        "remediation_planned",
        "remediated",
        "rollback_certified",
        "rejected"
      ]
    },
    "pack_id": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"},
    "bundle_id": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"},
    "gate_id": {"type": ["string", "null"]},
    "trust_verification_id": {"type": ["string", "null"]},
    "diff_id": {"type": ["string", "null"]},
    "status": {"enum": ["ready", "warning", "blocked"]},
    "artifact_refs": {"type": "array", "items": {"type": "object"}},
    "blockers": {"type": "array", "items": {"type": "string"}},
    "warnings": {"type": "array", "items": {"type": "string"}},
    "actor": {"type": "string"},
    "scm": {"type": "object"}
  }
}
