{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://trh.wtf/schemas/trh-registry-record.schema.json",
  "title": "TRH Registry Record",
  "type": "object",
  "required": [
    "canonical_id",
    "namespace",
    "title",
    "lifecycle_status",
    "validation_state"
  ],
  "properties": {
    "canonical_id": { "type": "string", "minLength": 1 },
    "namespace": { "type": "string", "minLength": 1 },
    "title": { "type": "string", "minLength": 1 },
    "category": { "type": ["string", "null"] },
    "purpose": { "type": ["string", "null"] },
    "version": { "type": ["string", "null"] },
    "lifecycle_status": {
      "enum": ["ACTIVE", "DEPRECATED", "SUPERSEDED", "REVOKED", "ARCHIVED"]
    },
    "validation_state": {
      "enum": ["VALID", "MODIFIED", "UNREGISTERED", "INVALID", "REVOKED"]
    },
    "artifact_sha256": {
      "oneOf": [
        { "type": "string", "pattern": "^[a-f0-9]{64}$" },
        { "type": "null" }
      ]
    },
    "payload_sha256": {
      "oneOf": [
        { "type": "string", "pattern": "^[a-f0-9]{64}$" },
        { "type": "null" }
      ]
    },
    "approval_date": { "type": ["string", "null"] },
    "supersedes": { "type": "array", "items": { "type": "string" } },
    "replacement": { "type": ["string", "null"] },
    "artifact_url": { "type": ["string", "null"] },
    "manifest_url": { "type": ["string", "null"] }
  },
  "additionalProperties": true
}
