{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bynder/json-schema/bynder-automation-workflow-rule-body-schema.json",
  "title": "AutomationWorkflowRuleBody",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bynder-automation-workflow-rules-api-openapi.yml#/components/schemas/AutomationWorkflowRuleBody",
  "type": "object",
  "required": [
    "name"
  ],
  "properties": {
    "name": {
      "type": "string"
    },
    "triggers": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "steps": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AutomationWorkflowStep"
      }
    }
  },
  "$defs": {
    "AndCondition": {
      "title": "AndCondition",
      "type": "object",
      "properties": {
        "AND": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LeafCondition"
          }
        }
      }
    },
    "AutomationWorkflowStep": {
      "title": "AutomationWorkflowStep",
      "type": "object",
      "properties": {
        "step_triggers": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "actions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AutomationWorkflowStepActionBase"
          }
        },
        "conditions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AndCondition"
          }
        }
      }
    },
    "AutomationWorkflowStepActionAgent": {
      "title": "AutomationWorkflowStepActionAgent",
      "type": "object",
      "required": [
        "action_type",
        "data"
      ],
      "properties": {
        "action_type": {
          "type": "string"
        },
        "data": {
          "$ref": "#/$defs/StepActionAgentData"
        }
      }
    },
    "AutomationWorkflowStepActionBase": {
      "title": "AutomationWorkflowStepActionBase",
      "oneOf": [
        {
          "$ref": "#/$defs/AutomationWorkflowStepActionAgent"
        }
      ]
    },
    "ExpressionCondition": {
      "title": "ExpressionCondition",
      "type": "object",
      "required": [
        "operator"
      ],
      "properties": {
        "term": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "operator": {
          "type": "string"
        }
      }
    },
    "LeafCondition": {
      "title": "LeafCondition",
      "type": "object",
      "required": [
        "condition_type",
        "expression"
      ],
      "properties": {
        "condition_type": {
          "type": "string"
        },
        "expression": {
          "$ref": "#/$defs/ExpressionCondition"
        }
      }
    },
    "StepActionAgentData": {
      "title": "StepActionAgentData",
      "type": "object",
      "required": [
        "agentId"
      ],
      "properties": {
        "agentId": {
          "type": "string"
        }
      }
    }
  }
}