{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oms.local/schemas/review-delivery-payload.schema.json",
  "title": "OMS review delivery payload",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "delivery_id", "repository", "issue_number", "issue_node_id", "issue_url_sha256",
    "source_ref_sha256", "subject", "result_gate_id", "authorization_id", "conductor_session_id",
    "base_branch", "review_branch", "required_check", "created_at", "updated_at",
    "preflight_secret_scan", "final_secret_scan", "contacts", "pull_request",
    "pull_request_event", "check_event", "proof", "blocked_reason"
  ],
  "properties": {
    "delivery_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
    "repository": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,38}/[a-z0-9._-]{1,100}$" },
    "issue_number": { "type": "integer", "minimum": 1 },
    "issue_node_id": { "type": "string", "pattern": "^[A-Za-z0-9_=-]{1,256}$" },
    "issue_url_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "source_ref_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "subject": { "type": "object" },
    "result_gate_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
    "authorization_id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
    "conductor_session_id": {
      "type": "string",
      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
    },
    "base_branch": { "const": "main" },
    "review_branch": { "type": "string", "pattern": "^oms-ticket-[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$" },
    "required_check": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._:/-]{0,127}$" },
    "created_at": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$" },
    "updated_at": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$" },
    "preflight_secret_scan": { "type": "object" },
    "final_secret_scan": { "type": ["object", "null"] },
    "contacts": { "type": "array", "maxItems": 32, "items": { "type": "object" } },
    "pull_request": { "type": ["object", "null"] },
    "pull_request_event": { "type": ["object", "null"] },
    "check_event": { "type": ["object", "null"] },
    "proof": { "type": ["object", "null"] },
    "blocked_reason": { "type": ["string", "null"], "minLength": 1, "maxLength": 512 }
  }
}
