{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kinra.ai/docs/truth-machine/schemas/record.schema.json",
  "title": "Truth Machine reference record packet",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "id", "domain", "title", "status", "created_on", "document", "change", "evidence", "documents"],
  "properties": {
    "schema_version": {"const": 1},
    "id": {"type": "string", "pattern": "^TMR-[0-9]{4}$"},
    "domain": {"type": "string", "pattern": "^[a-z][a-z0-9-]*$"},
    "title": {"type": "string", "minLength": 1},
    "status": {"enum": ["proposed", "accepted"]},
    "created_on": {"type": "string", "format": "date"},
    "accepted_on": {"type": "string", "format": "date"},
    "document": {"const": "README.md"},
    "change": {"type": "string", "pattern": "^TMC-[0-9]{4}$"},
    "supersedes": {"type": "string", "pattern": "^TMR-[0-9]{4}$"},
    "evidence": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {"type": "string", "pattern": "^TME-[0-9]{8}-[0-9]{4}$"}
    },
    "documents": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["path", "sha256"],
        "properties": {
          "path": {"type": "string", "minLength": 1},
          "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}
        }
      }
    }
  }
}
