Define what each decision needs
Define the choices in JSON Schema. A refund requires a transaction ID and amount. An escalation requires a reason and team. Each result follows one branch, with the fields that branch needs.
Resolution
View JSON Schema
{
"type": "object",
"properties": {
"department": { "const": "billing" },
"resolution": {
"oneOf": [
{
"type": "object",
"properties": {
"action": { "const": "refund" },
"transaction_id": { "type": "string" },
"amount_cents": {
"type": "integer", "minimum": 1
}
},
"required": [
"action", "transaction_id", "amount_cents"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"action": { "const": "escalate" },
"reason": { "type": "string" },
"team": { "enum": ["payments", "disputes"] }
},
"required": ["action", "reason", "team"],
"additionalProperties": false
}
]
}
},
"required": ["department", "resolution"],
"additionalProperties": false
}