{
  "spec_version": "0.2.1",
  "kind": "action",
  "name": "documents.decide",
  "purpose": "为指定修订的文档记录审批决定",
  "contract_revision": "1",
  "effect": "submit",
  "required_context": [
    "scope_id",
    "document_id"
  ],
  "input_schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "scope_id": {
        "const": "scope_demo"
      },
      "document_id": {
        "type": "string",
        "minLength": 1
      },
      "expected_revision": {
        "type": "integer",
        "minimum": 1
      },
      "decision": {
        "enum": [
          "approve",
          "request_changes"
        ]
      },
      "comment": {
        "type": "string",
        "maxLength": 2000
      },
      "operation_key": {
        "type": "string",
        "minLength": 16,
        "maxLength": 128
      }
    },
    "required": [
      "scope_id",
      "document_id",
      "expected_revision",
      "decision",
      "operation_key"
    ],
    "additionalProperties": false,
    "allOf": [
      {
        "if": {
          "properties": {
            "decision": {
              "const": "request_changes"
            }
          }
        },
        "then": {
          "required": [
            "comment"
          ],
          "properties": {
            "comment": {
              "type": "string",
              "minLength": 1,
              "pattern": "\\S"
            }
          }
        }
      }
    ]
  },
  "output_schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$ref": "../../schemas/0.2.1/axi.schema.json#/$defs/result"
  },
  "authorization": "从调用身份核对 scope_demo 读取权限；审批写入还需 reviewer 权限。此例身份由本地程序模拟。",
  "idempotency": {
    "mode": "required",
    "key_field": "operation_key",
    "recovery_action": "operations.get",
    "retention_seconds": 86400
  },
  "bindings": [
    {
      "kind": "cli",
      "target": "python examples/review/provider.py decide"
    }
  ]
}
