{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/asap-cool/json-schema/asap-cool-proposal-view-schema.json",
  "title": "ProposalView",
  "description": "A proposal raised by the system.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/asap-cool-automation-api-openapi.yml#/components/schemas/ProposalView",
  "type": "object",
  "required": [
    "id",
    "action_kind",
    "owner_module",
    "risk_class",
    "reversal",
    "tier",
    "status",
    "reason",
    "trigger_ref",
    "preview",
    "created_at",
    "expires_at",
    "edited",
    "credits_spent",
    "undoable"
  ],
  "properties": {
    "action_kind": {
      "type": "string",
      "description": "Wire name of the action kind (`invoice_overdue_reminder`,\n`invoice_overdue_task`, `quote_expiring_task`)."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "When the proposal was raised."
    },
    "credits_spent": {
      "type": "integer",
      "format": "int32",
      "description": "Credits the evaluation debited (`0` for a deterministic kind)."
    },
    "decided_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When it was decided; null while open."
    },
    "decided_by": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Who decided; null while open, or for a token with no user behind it."
    },
    "edited": {
      "type": "boolean",
      "description": "Whether the content was changed before approval."
    },
    "error_class": {
      "type": [
        "string",
        "null"
      ],
      "description": "Why the proposal `failed`: a closed token (`document_not_overdue`,\n`ladder_exhausted`, `enqueue_failed`...), never content. Null otherwise."
    },
    "execute_after": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "End of the cancel window of a `t3a` / `t3b` proposal: when it runs unless\ncancelled. Null for a proposal that is not scheduled."
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "When it lapses without a decision."
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Proposal id."
    },
    "owner_module": {
      "type": "string",
      "description": "Slug of the app the card is badged with."
    },
    "preview": {
      "description": "Server-trusted recap of the action."
    },
    "reason": {
      "type": "string",
      "description": "One sentence saying why the system proposes this."
    },
    "reversal": {
      "type": "string",
      "description": "How an executed action can be undone: `undo` (exactly, with no time limit,\nthrough `POST …/undo` while the task it made is still open and untouched),\n`compensate` or `none`."
    },
    "risk_class": {
      "type": "string",
      "description": "`internal_reversible`, `external` or `non_delegable`."
    },
    "status": {
      "type": "string",
      "description": "`pending`, `scheduled`, `consumed`, `rejected`, `cancelled`, `expired`,\n`failed` or `reverted` (executed, then undone)."
    },
    "tier": {
      "type": "string",
      "description": "Tier applied when the proposal was raised: `t0`, `t1`, `t2`, `t3a` or `t3b`."
    },
    "trigger_ref": {
      "description": "What caused the proposal and the id of the object concerned."
    },
    "undoable": {
      "type": "boolean",
      "description": "Whether `POST …/undo` would succeed now: the proposal was executed\n(`consumed`), its kind has an exact undo and the task it created is still\nopen and untouched. Read when the proposal is listed or fetched; `false`\nfor every other proposal."
    }
  }
}