{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "additionalProperties": false,
 "properties": {
  "artifact_refs": {
   "items": {
    "additionalProperties": false,
    "properties": {
     "file_id": {
      "pattern": "^[A-Za-z0-9_-]{10,128}$",
      "type": "string"
     },
     "name": {
      "maxLength": 240,
      "minLength": 1,
      "type": "string"
     },
     "sha256": {
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
     }
    },
    "required": [
     "name",
     "file_id",
     "sha256"
    ],
    "type": "object"
   },
   "maxItems": 64,
   "minItems": 1,
   "type": "array"
  },
  "auth_binding": {
   "additionalProperties": false,
   "properties": {
    "actor": {
     "enum": [
      "builder",
      "auditor",
      "owner"
     ]
    },
    "key_id": {
     "pattern": "^[0-9a-f]{16}$",
     "type": "string"
    },
    "mode": {
     "enum": [
      "private-existing-auth",
      "public-writer-signed"
     ]
    },
    "signature": {
     "pattern": "^[0-9a-f]{128}$",
     "type": "string"
    }
   },
   "required": [
    "mode",
    "actor",
    "key_id",
    "signature"
   ],
   "type": "object"
  },
  "candidate_sha": {
   "oneOf": [
    {
     "type": "null"
    },
    {
     "pattern": "^[0-9a-f]{40}$",
     "type": "string"
    }
   ]
  },
  "created_at": {
   "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?Z$",
   "type": "string"
  },
  "dispatch_id": {
   "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
   "type": "string"
  },
  "kind": {
   "enum": [
    "BUILD",
    "REVIEW",
    "REPAIR"
   ]
  },
  "message_id": {
   "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
   "type": "string"
  },
  "module_id": {
   "pattern": "^[A-Za-z0-9._-]{1,128}$",
   "type": "string"
  },
  "parent_message_id": {
   "oneOf": [
    {
     "type": "null"
    },
    {
     "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
     "type": "string"
    }
   ]
  },
  "payload_sha256": {
   "pattern": "^[0-9a-f]{64}$",
   "type": "string"
  },
  "phase": {
   "const": "READY"
  },
  "project_id": {
   "pattern": "^[A-Za-z0-9._-]{1,128}$",
   "type": "string"
  },
  "protocol_revision": {
   "const": "drive-inbox-20261104"
  },
  "recipient_role": {
   "enum": [
    "builder",
    "auditor"
   ]
  },
  "run_id": {
   "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
   "type": "string"
  },
  "schema": {
   "const": "hayat-message-1"
  },
  "sender_role": {
   "enum": [
    "builder",
    "auditor"
   ]
  },
  "task_sha256": {
   "pattern": "^[0-9a-f]{64}$",
   "type": "string"
  }
 },
 "required": [
  "schema",
  "protocol_revision",
  "project_id",
  "run_id",
  "message_id",
  "dispatch_id",
  "parent_message_id",
  "sender_role",
  "recipient_role",
  "kind",
  "module_id",
  "phase",
  "task_sha256",
  "candidate_sha",
  "artifact_refs",
  "payload_sha256",
  "created_at",
  "auth_binding"
 ],
 "type": "object"
}