{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://webbridgekit.dev/schemas/approval-status-v1.schema.json",
  "title": "WebBridgeKit Approval Status v1",
  "type": "object",
  "required": ["schema", "requestId", "state", "revision", "values", "createdAt", "updatedAt", "delivery"],
  "properties": {
    "schema": { "const": "webbridgekit.approval-status.v1" },
    "requestId": { "type": "string", "pattern": "^[A-Za-z0-9._:-]+$", "minLength": 1, "maxLength": 128 },
    "state": { "enum": ["pending", "approved", "rejected", "cancelled", "expired"] },
    "revision": { "type": "integer", "minimum": 1 },
    "actionId": { "type": ["string", "null"], "maxLength": 64 },
    "values": {
      "type": "object",
      "additionalProperties": { "type": "string" }
    },
    "respondedAt": { "type": ["string", "null"], "format": "date-time" },
    "createdAt": { "type": "string", "format": "date-time" },
    "updatedAt": { "type": "string", "format": "date-time" },
    "delivery": {
      "type": "object",
      "required": ["state", "attempts"],
      "properties": {
        "state": { "enum": ["notRequested", "pending", "delivered", "failed"] },
        "attempts": { "type": "integer", "minimum": 0 },
        "lastAttemptAt": { "type": ["string", "null"], "format": "date-time" },
        "lastError": { "type": ["string", "null"] }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
