{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/supermailos-com/json-schema/supermailos-com-agent-approval-schema.json",
  "title": "AgentApproval",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/supermailos-com-openapi.json#/components/schemas/AgentApproval",
  "type": "object",
  "required": [
    "id",
    "inboxId",
    "kind",
    "from",
    "to",
    "cc",
    "subject",
    "reasons",
    "status",
    "createdAt",
    "expiresAt"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "inboxId": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "enum": [
        "send",
        "reply"
      ]
    },
    "threadId": {
      "type": [
        "string",
        "null"
      ]
    },
    "from": {
      "type": "string",
      "format": "email"
    },
    "to": {
      "type": "string"
    },
    "cc": {
      "type": "string"
    },
    "bcc": {
      "type": "string",
      "description": "People's keys only."
    },
    "subject": {
      "type": "string"
    },
    "text": {
      "type": "string",
      "description": "The body the agent wrote (people's keys only)."
    },
    "html": {
      "type": "string",
      "description": "Its HTML version, when it wrote one (people's keys only): what most mail apps show."
    },
    "reasons": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "approved",
        "rejected",
        "sent",
        "failed",
        "expired"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "decidedAt": {
      "type": "string",
      "format": "date-time"
    },
    "decisionNote": {
      "type": "string",
      "description": "What the person said when deciding."
    },
    "result": {
      "type": "object",
      "description": "Once sent: `{ messageId, threadId, mailboxId }`. Once failed: `{ error, code }`."
    }
  }
}