{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rctp.dev/schemas/approval-status.schema.json",
  "title": "Approval status",
  "description": "Returned by GET /approvals/{id} and in approval.decided webhooks. No answer by expires_at is a decline (INV-2). For listing approvals it carries the listing, its term_set and terms_commitment, never the term values (INV-1).",
  "type": "object",
  "properties": {
    "approval_id": {
      "$ref": "common.schema.json#/$defs/ApprovalId"
    },
    "action": {
      "$ref": "common.schema.json#/$defs/Action"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "approved",
        "declined",
        "expired",
        "failed"
      ]
    },
    "reason": {
      "$ref": "common.schema.json#/$defs/Reason"
    },
    "level": {
      "$ref": "common.schema.json#/$defs/ApprovalLevel"
    },
    "expires_at": {
      "$ref": "common.schema.json#/$defs/Timestamp"
    },
    "decided_at": {
      "$ref": "common.schema.json#/$defs/Timestamp"
    },
    "offer_id": {
      "$ref": "common.schema.json#/$defs/OfferId"
    },
    "listing_id": {
      "$ref": "common.schema.json#/$defs/ListingId"
    },
    "term_set": {
      "$ref": "common.schema.json#/$defs/TermSetId"
    },
    "terms_commitment": {
      "$ref": "common.schema.json#/$defs/Digest"
    },
    "result": {
      "type": "object",
      "properties": {
        "status": {
          "type": "integer"
        },
        "body": {}
      },
      "additionalProperties": false,
      "required": [
        "status"
      ],
      "description": "Outcome of executing the approved action"
    }
  },
  "additionalProperties": false,
  "required": [
    "approval_id",
    "action",
    "status",
    "expires_at"
  ]
}
