{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/actionbox-cloud/json-schema/actionbox-cloud-action-patch-schema.json",
  "title": "ActionPatch",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/actionbox-cloud-openapi.json#/components/schemas/ActionPatch",
  "properties": {
    "chat_delivery": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "inherit",
            "disabled"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Chat Delivery"
    },
    "title": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 200,
          "minLength": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Title"
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 10000
        },
        {
          "type": "null"
        }
      ],
      "title": "Description"
    },
    "priority": {
      "anyOf": [
        {
          "$ref": "#/$defs/Priority"
        },
        {
          "type": "null"
        }
      ]
    },
    "open_url": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "minLength": 1,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ],
      "title": "Open Url"
    },
    "controls": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/ActionControl"
          },
          "type": "array",
          "maxItems": 12
        },
        {
          "type": "null"
        }
      ],
      "title": "Controls"
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expires At"
    },
    "on_expire": {
      "anyOf": [
        {
          "oneOf": [
            {
              "$ref": "#/$defs/ReturnExpiredOutcome"
            },
            {
              "$ref": "#/$defs/ResolveOnExpireOutcome"
            }
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "On Expire"
    },
    "context": {
      "anyOf": [
        {
          "items": {
            "oneOf": [
              {
                "$ref": "#/$defs/KeyValueContext"
              },
              {
                "$ref": "#/$defs/TextualContext"
              },
              {
                "$ref": "#/$defs/JsonContext"
              },
              {
                "$ref": "#/$defs/MetricsContext"
              },
              {
                "$ref": "#/$defs/LinksContext"
              }
            ]
          },
          "type": "array",
          "maxItems": 12
        },
        {
          "type": "null"
        }
      ],
      "title": "Context"
    },
    "decision_class": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 120,
          "minLength": 1,
          "pattern": "^[A-Za-z0-9_.-]+$"
        },
        {
          "type": "null"
        }
      ],
      "title": "Decision Class"
    },
    "decision_context": {
      "anyOf": [
        {
          "$ref": "#/$defs/DecisionContext"
        },
        {
          "type": "null"
        }
      ]
    },
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Metadata"
    }
  },
  "type": "object",
  "$defs": {
    "ActionControl": {
      "properties": {
        "key": {
          "type": "string",
          "maxLength": 64,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9_-]*$",
          "title": "Key"
        },
        "label": {
          "type": "string",
          "maxLength": 80,
          "minLength": 1,
          "title": "Label"
        },
        "kind": {
          "type": "string",
          "enum": [
            "callback",
            "link",
            "actionbox"
          ],
          "title": "Kind"
        },
        "url": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048,
              "minLength": 1,
              "format": "uri"
            },
            {
              "type": "null"
            }
          ],
          "title": "Url"
        },
        "destructive": {
          "type": "boolean",
          "title": "Destructive",
          "default": false
        },
        "expires_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Expires At"
        }
      },
      "type": "object",
      "required": [
        "key",
        "label",
        "kind"
      ],
      "title": "ActionControl",
      "description": "A bounded secondary operation exposed beside an Action's decision."
    },
    "BooleanResponse": {
      "properties": {
        "type": {
          "type": "string",
          "const": "boolean",
          "title": "Type"
        },
        "value": {
          "type": "boolean",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "title": "BooleanResponse"
    },
    "DecisionContext": {
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "title": "Schema Version",
          "default": 1
        },
        "reason": {
          "type": "string",
          "maxLength": 2000,
          "minLength": 1,
          "title": "Reason"
        },
        "current_state": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2000
            },
            {
              "type": "null"
            }
          ],
          "title": "Current State"
        },
        "proposed_change": {
          "type": "string",
          "maxLength": 2000,
          "minLength": 1,
          "title": "Proposed Change"
        },
        "expected_effect": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2000
            },
            {
              "type": "null"
            }
          ],
          "title": "Expected Effect"
        },
        "risk_level": {
          "type": "string",
          "enum": [
            "unknown",
            "low",
            "medium",
            "high",
            "critical"
          ],
          "title": "Risk Level"
        },
        "risk_summary": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2000
            },
            {
              "type": "null"
            }
          ],
          "title": "Risk Summary"
        },
        "reversibility": {
          "type": "string",
          "enum": [
            "unknown",
            "reversible",
            "partially_reversible",
            "irreversible"
          ],
          "title": "Reversibility"
        },
        "rollback_plan": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2000
            },
            {
              "type": "null"
            }
          ],
          "title": "Rollback Plan"
        },
        "affected_scope": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 20,
          "title": "Affected Scope"
        }
      },
      "type": "object",
      "required": [
        "reason",
        "proposed_change",
        "risk_level",
        "reversibility"
      ],
      "title": "DecisionContext"
    },
    "FormResponse": {
      "properties": {
        "type": {
          "type": "string",
          "const": "form",
          "title": "Type"
        },
        "values": {
          "additionalProperties": true,
          "type": "object",
          "title": "Values"
        }
      },
      "type": "object",
      "required": [
        "type",
        "values"
      ],
      "title": "FormResponse"
    },
    "IntegerResponse": {
      "properties": {
        "type": {
          "type": "string",
          "const": "integer",
          "title": "Type"
        },
        "value": {
          "type": "integer",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "title": "IntegerResponse"
    },
    "JsonContext": {
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 120
            },
            {
              "type": "null"
            }
          ],
          "title": "Title"
        },
        "type": {
          "type": "string",
          "const": "json",
          "title": "Type"
        },
        "value": {
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "title": "JsonContext"
    },
    "KeyValueContext": {
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 120
            },
            {
              "type": "null"
            }
          ],
          "title": "Title"
        },
        "type": {
          "type": "string",
          "const": "key_value",
          "title": "Type"
        },
        "items": {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": "object",
          "maxProperties": 50,
          "minProperties": 1,
          "title": "Items"
        }
      },
      "type": "object",
      "required": [
        "type",
        "items"
      ],
      "title": "KeyValueContext"
    },
    "LinkItem": {
      "properties": {
        "label": {
          "type": "string",
          "maxLength": 120,
          "minLength": 1,
          "title": "Label"
        },
        "url": {
          "type": "string",
          "maxLength": 2048,
          "minLength": 1,
          "format": "uri",
          "title": "Url"
        }
      },
      "type": "object",
      "required": [
        "label",
        "url"
      ],
      "title": "LinkItem"
    },
    "LinksContext": {
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 120
            },
            {
              "type": "null"
            }
          ],
          "title": "Title"
        },
        "type": {
          "type": "string",
          "const": "links",
          "title": "Type"
        },
        "items": {
          "items": {
            "$ref": "#/$defs/LinkItem"
          },
          "type": "array",
          "maxItems": 20,
          "minItems": 1,
          "title": "Items"
        }
      },
      "type": "object",
      "required": [
        "type",
        "items"
      ],
      "title": "LinksContext"
    },
    "MetricItem": {
      "properties": {
        "label": {
          "type": "string",
          "maxLength": 120,
          "minLength": 1,
          "title": "Label"
        },
        "value": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            }
          ],
          "title": "Value"
        },
        "unit": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 40
            },
            {
              "type": "null"
            }
          ],
          "title": "Unit"
        }
      },
      "type": "object",
      "required": [
        "label",
        "value"
      ],
      "title": "MetricItem"
    },
    "MetricsContext": {
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 120
            },
            {
              "type": "null"
            }
          ],
          "title": "Title"
        },
        "type": {
          "type": "string",
          "const": "metrics",
          "title": "Type"
        },
        "items": {
          "items": {
            "$ref": "#/$defs/MetricItem"
          },
          "type": "array",
          "maxItems": 20,
          "minItems": 1,
          "title": "Items"
        }
      },
      "type": "object",
      "required": [
        "type",
        "items"
      ],
      "title": "MetricsContext"
    },
    "MultiChoiceResponse": {
      "properties": {
        "type": {
          "type": "string",
          "const": "multi_choice",
          "title": "Type"
        },
        "value": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "title": "MultiChoiceResponse"
    },
    "NumberResponse": {
      "properties": {
        "type": {
          "type": "string",
          "const": "number",
          "title": "Type"
        },
        "value": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "number"
            }
          ],
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "title": "NumberResponse"
    },
    "Priority": {
      "type": "string",
      "enum": [
        "low",
        "normal",
        "high",
        "urgent"
      ],
      "title": "Priority"
    },
    "RatingResponse": {
      "properties": {
        "type": {
          "type": "string",
          "const": "rating",
          "title": "Type"
        },
        "value": {
          "type": "integer",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "title": "RatingResponse"
    },
    "ResolveOnExpireOutcome": {
      "properties": {
        "type": {
          "type": "string",
          "const": "resolve",
          "title": "Type"
        },
        "response": {
          "oneOf": [
            {
              "$ref": "#/$defs/BooleanResponse"
            },
            {
              "$ref": "#/$defs/TextResponse"
            },
            {
              "$ref": "#/$defs/IntegerResponse"
            },
            {
              "$ref": "#/$defs/NumberResponse"
            },
            {
              "$ref": "#/$defs/RatingResponse"
            },
            {
              "$ref": "#/$defs/SingleChoiceResponse"
            },
            {
              "$ref": "#/$defs/MultiChoiceResponse"
            },
            {
              "$ref": "#/$defs/FormResponse"
            }
          ],
          "title": "Response"
        },
        "reason": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500
            },
            {
              "type": "null"
            }
          ],
          "title": "Reason",
          "default": "expiration fallback"
        }
      },
      "type": "object",
      "required": [
        "type",
        "response"
      ],
      "title": "ResolveOnExpireOutcome"
    },
    "ReturnExpiredOutcome": {
      "properties": {
        "type": {
          "type": "string",
          "const": "return_expired",
          "title": "Type",
          "default": "return_expired"
        }
      },
      "type": "object",
      "title": "ReturnExpiredOutcome"
    },
    "SingleChoiceResponse": {
      "properties": {
        "type": {
          "type": "string",
          "const": "single_choice",
          "title": "Type"
        },
        "value": {
          "type": "string",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "title": "SingleChoiceResponse"
    },
    "TextResponse": {
      "properties": {
        "type": {
          "type": "string",
          "const": "text",
          "title": "Type"
        },
        "value": {
          "type": "string",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "title": "TextResponse"
    },
    "TextualContext": {
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 120
            },
            {
              "type": "null"
            }
          ],
          "title": "Title"
        },
        "type": {
          "type": "string",
          "enum": [
            "code",
            "diff",
            "logs",
            "command"
          ],
          "title": "Type"
        },
        "content": {
          "type": "string",
          "maxLength": 20000,
          "minLength": 1,
          "title": "Content"
        },
        "language": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 40
            },
            {
              "type": "null"
            }
          ],
          "title": "Language"
        }
      },
      "type": "object",
      "required": [
        "type",
        "content"
      ],
      "title": "TextualContext"
    }
  }
}