{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oms.local/schemas/reflection-evidence.schema.json",
  "title": "OMS bounded reflection evidence",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "ticket_id",
    "deterministic_evidence",
    "failure_evidence",
    "attempt",
    "advisory_only",
    "advice"
  ],
  "properties": {
    "schema_version": { "const": 1 },
    "ticket_id": {
      "type": "string",
      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
    },
    "deterministic_evidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["evidence_id", "sha256", "file_name"],
      "properties": {
        "evidence_id": {
          "type": "string",
          "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
        },
        "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
        "file_name": { "type": "string", "maxLength": 69 }
      }
    },
    "failure_evidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["evidence_id", "sha256", "file_name"],
      "properties": {
        "evidence_id": {
          "type": "string",
          "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
        },
        "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
        "file_name": { "type": "string", "maxLength": 69 }
      }
    },
    "attempt": { "type": "integer", "minimum": 1 },
    "advisory_only": { "const": true },
    "advice": {
      "type": "object",
      "additionalProperties": false,
      "required": ["failure", "lesson", "next_attempt"],
      "properties": {
        "failure": { "type": "string", "minLength": 1, "maxLength": 8192 },
        "lesson": { "type": "string", "minLength": 1, "maxLength": 8192 },
        "next_attempt": { "type": "string", "minLength": 1, "maxLength": 8192 }
      }
    }
  }
}
