{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.norruva.com/nrpf/v1/nrpf-evidence.schema.json",
  "title": "NRPF Evidence Reference",
  "description": "A reference to a compliance evidence artefact — certificate, test report, audit document, or image. Derived from the Evidence entity (@modules/compliance-evidence/domain/entities/Evidence.ts). Enforces content integrity.",
  "$comment": "@task P2-W4-13 @epic P2-ConsumerDistribution",
  "type": "object",
  "required": ["id", "category", "fileName", "validationStatus", "uploadedBy", "createdAt"],
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for this evidence record."
    },
    "passportId": {
      "type": "string",
      "format": "uuid",
      "description": "Identifier of the Digital Product Passport this evidence is attached to."
    },
    "category": {
      "type": "string",
      "enum": ["certificate", "manual", "test_report", "image"],
      "description": "Classification of the evidence document."
    },
    "fileName": {
      "type": "string",
      "minLength": 1,
      "description": "Original file name of the evidence artefact."
    },
    "fileSize": {
      "type": "integer",
      "minimum": 0,
      "description": "File size in bytes."
    },
    "mimeType": {
      "type": "string",
      "description": "MIME type of the file (e.g. application/pdf, image/jpeg).",
      "examples": ["application/pdf", "image/jpeg", "image/png", "application/octet-stream"]
    },
    "publicUrl": {
      "type": "string",
      "format": "uri",
      "description": "Publicly accessible URL to download the evidence file."
    },
    "validationStatus": {
      "type": "string",
      "enum": ["pending", "verified", "rejected"],
      "description": "Current verification status of this evidence."
    },
    "failureReason": {
      "type": "string",
      "description": "Reason for rejection when validationStatus is 'rejected'."
    },
    "uploadedBy": {
      "type": "string",
      "description": "User identifier of the person who uploaded this evidence."
    },
    "contentHash": {
      "type": ["string", "null"],
      "pattern": "^[0-9a-f]{64}$",
      "description": "SHA-256 hex digest of the raw file bytes. Null for records predating content hashing. Used for tamper detection."
    },
    "hashAlgorithm": {
      "type": ["string", "null"],
      "description": "Algorithm used to produce contentHash. Defaults to 'SHA-256' when contentHash is present.",
      "examples": ["SHA-256"]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp when this evidence record was created."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp when this evidence record was last updated."
    }
  }
}
