{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thesoftwarelens.com/saacip/0.1/schemas/approval.schema.json",
  "$comment": "SaaCIP 0.1 (https://thesoftwarelens.com/saacip/). Licensed under the Apache License 2.0.",
  "title": "SaaCIP 0.1 Resident binding: approval",
  "description": "A declared action waiting for, or given, a person's decision. Returned by POST <base>/approvals/ and listed in the inbox once decided.",
  "type": "object",
  "required": [
    "id",
    "action_id",
    "ref",
    "action",
    "status"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "The hub's identifier for this approval; used to acknowledge it."
    },
    "action_id": {
      "$ref": "common.schema.json#/$defs/ref"
    },
    "ref": {
      "$ref": "common.schema.json#/$defs/ref"
    },
    "action": {
      "type": "string",
      "description": "The id of the declared action."
    },
    "summary": {
      "type": "string"
    },
    "status": {
      "enum": [
        "pending",
        "approved",
        "rejected"
      ]
    },
    "decided_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "The person who decided, as the hub names them; null while pending."
    },
    "decided_at": {
      "oneOf": [
        {
          "$ref": "common.schema.json#/$defs/rfc3339"
        },
        {
          "type": "null"
        }
      ],
      "description": "When they decided; null while pending."
    }
  }
}
