{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://trh.wtf/schemas/trh-manifest.schema.json",
  "title": "TRH Artifact Manifest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "manifest_version",
    "canonical_id",
    "collection_id",
    "artifact_version",
    "release",
    "lifecycle_status",
    "validation_state",
    "artifact_sha256",
    "payload_sha256",
    "wrapper_profile",
    "media_type",
    "created_at",
    "approved_at",
    "supersedes",
    "errata",
    "signature"
  ],
  "properties": {
    "$schema": { "type": "string" },
    "manifest_version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
    "canonical_id": { "type": "string", "minLength": 1 },
    "collection_id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
    "artifact_version": { "type": "string", "minLength": 1 },
    "release": { "type": "string", "minLength": 1 },
    "lifecycle_status": {
      "enum": ["ACTIVE", "DEPRECATED", "SUPERSEDED", "REVOKED", "ARCHIVED"]
    },
    "validation_state": {
      "enum": ["VALID", "MODIFIED", "UNREGISTERED", "INVALID", "REVOKED"]
    },
    "artifact_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "payload_sha256": {
      "oneOf": [
        { "type": "string", "pattern": "^[a-f0-9]{64}$" },
        { "type": "null" }
      ]
    },
    "wrapper_profile": {
      "oneOf": [
        { "const": "TRH-WRAPPED-1" },
        { "type": "null" }
      ]
    },
    "media_type": { "type": "string", "minLength": 1 },
    "created_at": { "type": "string", "minLength": 4 },
    "approved_at": { "type": ["string", "null"] },
    "supersedes": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
    "errata": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
    "signature": {
      "oneOf": [
        { "$ref": "trh-signature.schema.json" },
        { "type": "null" }
      ]
    }
  }
}
