"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-NJK5F5TF.cjs');

// src/definitions/workflow-definition.json
var openapi = "3.0.0";
var info = {
  title: "Workflows Definitions",
  version: "1.0.0",
  description: "Service for Workflow Definitions for different processes inside of an Organization\n"
};
var servers = [
  {
    url: "https://workflows-definition.sls.epilot.io"
  }
];
var security = [
  {
    BearerAuth: []
  }
];
var paths = {
  "/v1/workflows/limits/max-allowed": {
    get: {
      operationId: "getMaxAllowedLimit",
      summary: "getMaxAllowedLimit",
      description: "Get limits and number of created executions for an Organization.",
      tags: ["Workflows"],
      responses: {
        "200": {
          description: "A combo of current number of workflows, and the max allowed number of workflows.",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/MaxAllowedLimit"
              },
              example: {
                currentNoOfWorkflows: 5,
                maxAllowed: 7
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    }
  },
  "/v1/workflows/definitions": {
    get: {
      operationId: "getDefinitions",
      summary: "getDefinitions",
      description: "Retrieve all Workflow Definitions from an Organization",
      tags: ["Workflows"],
      responses: {
        "200": {
          description: "Success - definitions loaded with success. Empty array if org has no definitions.",
          content: {
            "application/json": {
              schema: {
                type: "array",
                items: {
                  $ref: "#/components/schemas/WorkflowDefinition"
                }
              },
              example: [
                {
                  id: "25n2k52ja",
                  name: "Lead Qualification",
                  assignedTo: ["18625", "90252"],
                  description: "Lead Qualification description",
                  lastUpdateTime: "2021-08-04T21:13:50.373Z",
                  creationTime: "2021-08-04T21:13:50.373Z",
                  dueDate: "2021-08-04T21:13:50.373Z",
                  flow: [
                    {
                      id: "5892na2",
                      name: "Initial Information Gathering",
                      order: 1,
                      type: "SECTION",
                      steps: [
                        {
                          id: "2hja82a",
                          name: "Call client and confirm address and product",
                          type: "STEP",
                          order: 1,
                          assignedTo: ["123482"]
                        },
                        {
                          id: "ga92ha2",
                          name: "Check product availability",
                          type: "STEP",
                          order: 2,
                          assignedTo: ["123482"]
                        },
                        {
                          id: "jga92ha",
                          name: "Send email confirming contact with the client",
                          type: "STEP",
                          order: 3,
                          assignedTo: ["123482"]
                        }
                      ]
                    },
                    {
                      id: "0a7g22a",
                      name: "Print and send catalog",
                      type: "STEP",
                      order: 2,
                      assignedTo: ["123482"]
                    }
                  ]
                }
              ]
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    },
    post: {
      operationId: "createDefinition",
      summary: "createDefinition",
      description: "Create a Workflow Definition.",
      tags: ["Workflows"],
      requestBody: {
        description: "Workflow Definition payload",
        required: true,
        content: {
          "application/json": {
            schema: {
              $ref: "#/components/schemas/WorkflowDefinition"
            },
            example: {
              name: "Lead Qualification",
              description: "Lead Qualification description",
              dueDate: "2022-08-04T12:00:00.000Z",
              assignedTo: ["952802", "80225"],
              flow: [
                {
                  name: "Initial Information Gathering",
                  order: 1,
                  type: "SECTION",
                  steps: [
                    {
                      name: "Call client and confirm address and product",
                      type: "STEP",
                      order: 1,
                      assignedTo: ["123482"]
                    },
                    {
                      name: "Check product availability",
                      type: "STEP",
                      order: 2,
                      assignedTo: ["123482"]
                    },
                    {
                      name: "Send email confirming contact with the client",
                      type: "STEP",
                      order: 3,
                      assignedTo: ["123482"]
                    }
                  ]
                },
                {
                  name: "Print and send catalog",
                  type: "STEP",
                  order: 2,
                  assignedTo: ["123482"]
                }
              ]
            }
          }
        }
      },
      responses: {
        "201": {
          description: "Success - if the definition is created successfully",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/WorkflowDefinition"
              },
              example: {
                id: "25n2k52ja",
                name: "Lead Qualification",
                description: "Lead Qualification description",
                lastUpdateTime: "2021-08-04T21:13:50.373Z",
                creationTime: "2021-08-04T21:13:50.373Z",
                dueDate: "2022-08-04T12:00:00.000Z",
                assignedTo: ["952802", "80225"],
                flow: [
                  {
                    id: "5892na2",
                    name: "Initial Information Gathering",
                    order: 1,
                    type: "SECTION",
                    steps: [
                      {
                        id: "2hja82a",
                        name: "Call client and confirm address and product",
                        type: "STEP",
                        order: 1,
                        assignedTo: ["48829"]
                      },
                      {
                        id: "ga92ha2",
                        name: "Check product availability",
                        type: "STEP",
                        order: 2,
                        assignedTo: ["45390"]
                      },
                      {
                        id: "jga92ha",
                        name: "Send email confirming contact with the client",
                        type: "STEP",
                        order: 3,
                        assignedTo: ["8230"]
                      }
                    ]
                  },
                  {
                    id: "0a7g22a",
                    name: "Print and send catalog",
                    type: "STEP",
                    order: 2,
                    assignedTo: ["8239"]
                  }
                ]
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "401": {
          description: "Authentication Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    }
  },
  "/v2/flows/templates": {
    get: {
      operationId: "listFlowTemplates",
      summary: "listFlowTemplates",
      description: "List all Flow Templates for a customer. Optionally, you can filter flow templates by trigger values.",
      tags: ["Flows V2"],
      parameters: [
        {
          in: "query",
          name: "trigger_type",
          schema: {
            type: "string",
            enum: ["automation", "manual", "journey_submission"]
          },
          required: false,
          description: "Type of trigger for whom to filter flow templates",
          example: "journey_submission"
        },
        {
          in: "query",
          name: "trigger_source_id",
          schema: {
            type: "string"
          },
          required: false,
          description: "Id of the trigger source to filter flow templates. Interpretation depends on **trigger_type**:\n- **automation**: use an `{automation_flow_id}` value\n- **journey_submission**: use a `{journey_id}` value\n- **manual**: this parameter is ignored; you can optionally filter by `{trigger_schema}`\n",
          example: "j208g0aj-08g9agajggak-g9aug9-892kgl1m"
        },
        {
          in: "query",
          name: "trigger_schema",
          schema: {
            type: "string"
          },
          required: false,
          description: "Schema of the trigger source to filter flow templates. This parameter only makes sense when **trigger_type** is `manual`\n",
          example: "opportunity"
        }
      ],
      responses: {
        "200": {
          description: "Success - flow templates loaded with success. Empty array if customer has no flows defined.",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/FlowTemplatesList"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    },
    post: {
      operationId: "createFlowTemplate",
      summary: "createFlowTemplate",
      description: "Create a new Flow Template.",
      tags: ["Flows V2"],
      requestBody: {
        description: "Flow Template payload",
        required: true,
        content: {
          "application/json": {
            schema: {
              $ref: "#/components/schemas/CreateFlowTemplate"
            }
          }
        }
      },
      responses: {
        "201": {
          description: "Success - if the flow template is created successfully",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/FlowTemplate"
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "401": {
          description: "Authentication Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    }
  },
  "/v2/flows/templates:search": {
    post: {
      operationId: "searchFlowTemplates",
      summary: "searchFlowTemplates",
      description: "Search for flow templates by name, trigger type, enabled status, and more.",
      tags: ["Flows V2"],
      requestBody: {
        description: "Search for flow templates by name, trigger type, enabled status, and more.",
        required: true,
        content: {
          "application/json": {
            schema: {
              $ref: "#/components/schemas/SearchFlowTemplates"
            },
            example: {
              name: "Lead Qualification",
              definition_id: "25n2k52ja",
              trigger_type: "journey_submission",
              enabled: true,
              from: 0,
              size: 10
            }
          }
        }
      },
      responses: {
        "200": {
          description: "Success - flow templates loaded with success. Empty array if customer has no flows defined.",
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  hits: {
                    type: "number"
                  },
                  results: {
                    type: "array",
                    items: {
                      $ref: "#/components/schemas/FlowTemplate"
                    }
                  }
                }
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    }
  },
  "/v2/flows/templates/{flowId}": {
    get: {
      operationId: "getFlowTemplate",
      summary: "getFlowTemplate",
      description: "Get specific FLow template for a customer",
      tags: ["Flows V2"],
      parameters: [
        {
          in: "path",
          name: "flowId",
          schema: {
            $ref: "#/components/schemas/FlowTemplateId"
          },
          required: true
        }
      ],
      responses: {
        "200": {
          description: "Returns the Flow Template",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/FlowTemplate"
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "401": {
          description: "Authentication Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "404": {
          description: "Definition Not found",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/DefinitionNotFoundResp"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    },
    put: {
      operationId: "updateFlowTemplate",
      summary: "updateFlowTemplate",
      description: "Update Flow Template.",
      tags: ["Flows V2"],
      parameters: [
        {
          in: "path",
          name: "flowId",
          schema: {
            $ref: "#/components/schemas/FlowTemplateId"
          },
          required: true
        }
      ],
      requestBody: {
        description: "Flow Template payload",
        required: true,
        content: {
          "application/json": {
            schema: {
              $ref: "#/components/schemas/FlowTemplate"
            }
          }
        }
      },
      responses: {
        "200": {
          description: "Flow template has been updated successfully",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/FlowTemplate"
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "401": {
          description: "Authentication Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    },
    delete: {
      operationId: "deleteFlowTemplate",
      summary: "deleteFlowTemplate",
      description: "Delete Flow Template.",
      tags: ["Flows V2"],
      parameters: [
        {
          in: "path",
          name: "flowId",
          schema: {
            $ref: "#/components/schemas/FlowTemplateId"
          },
          required: true,
          description: "Id of the flow template to de deleted."
        }
      ],
      responses: {
        "204": {
          description: "Flow template has been deleted successfully"
        },
        "401": {
          description: "Failed to authenticate",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "404": {
          description: "No definition found"
        }
      }
    }
  },
  "/v2/flows/templates/{flowId}/duplicate": {
    post: {
      operationId: "duplicateFlowTemplate",
      summary: "duplicateFlowTemplate",
      description: "Duplicate a Flow Template from an existing workflow.",
      tags: ["Flows V2"],
      parameters: [
        {
          in: "path",
          name: "flowId",
          schema: {
            $ref: "#/components/schemas/FlowTemplateId"
          },
          required: true
        }
      ],
      responses: {
        "201": {
          description: "Flow template has been duplicated successfully",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/FlowTemplate"
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "401": {
          description: "Authentication Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    }
  },
  "/v2/flows/templates/{flowId}/export": {
    get: {
      operationId: "exportFlowTemplate",
      summary: "exportFlowTemplate",
      description: "Export a Flow Template with all referenced automations resolved and bundled alongside.",
      tags: ["Flows V2"],
      parameters: [
        {
          in: "path",
          name: "flowId",
          schema: {
            $ref: "#/components/schemas/FlowTemplateId"
          },
          required: true
        }
      ],
      responses: {
        "200": {
          description: "Exported flow template with resolved automations",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/FlowTemplateExport"
              }
            }
          }
        },
        "401": {
          description: "Authentication Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "404": {
          description: "Flow template not found",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    }
  },
  "/v2/flows/templates/import": {
    post: {
      operationId: "importFlowTemplate",
      summary: "importFlowTemplate",
      description: "Import a Flow Template from an export payload. Creates all automations and the flow in the caller's organization.",
      tags: ["Flows V2"],
      requestBody: {
        description: "Export payload containing the flow template and resolved automations",
        required: true,
        content: {
          "application/json": {
            schema: {
              $ref: "#/components/schemas/FlowTemplateExport"
            }
          }
        }
      },
      responses: {
        "201": {
          description: "Flow template imported successfully",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/FlowTemplateImportResult"
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "401": {
          description: "Authentication Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    }
  },
  "/v1/workflows/definitions/{definitionId}": {
    get: {
      operationId: "getDefinition",
      summary: "getDefinition",
      description: "Get specific Definition by id from the Organization.",
      tags: ["Workflows"],
      parameters: [
        {
          in: "path",
          name: "definitionId",
          schema: {
            type: "string"
          },
          required: true,
          description: "Short uuid (length 8) to identify the Workflow Definition.",
          example: "7hj28a"
        }
      ],
      responses: {
        "200": {
          description: "Returns the Workflow definition",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/WorkflowDefinition"
              },
              example: {
                id: "25n2k52ja",
                name: "Lead Qualification",
                dueDate: "2022-08-04T12:00:00.000Z",
                assignedTo: ["952802", "80225"],
                lastUpdateTime: "2021-08-04T21:13:50.373Z",
                creationTime: "2021-08-04T21:13:50.373Z",
                flow: [
                  {
                    id: "5892na2",
                    name: "Initial Information Gathering",
                    order: 1,
                    type: "SECTION",
                    steps: [
                      {
                        id: "2hja82a",
                        name: "Call client and confirm address and product",
                        type: "STEP",
                        order: 1,
                        assignedTo: ["923432"]
                      },
                      {
                        id: "ga92ha2",
                        name: "Check product availability",
                        type: "STEP",
                        order: 2,
                        assignedTo: ["45488"]
                      },
                      {
                        id: "jga92ha",
                        name: "Send email confirming contact with the client",
                        type: "STEP",
                        order: 3,
                        assignedTo: ["45488"]
                      }
                    ]
                  },
                  {
                    id: "0a7g22a",
                    name: "Print and send catalog",
                    type: "STEP",
                    order: 2,
                    assignedTo: ["8988"]
                  }
                ],
                closingReasons: [
                  {
                    id: "ffoowef",
                    title: "test"
                  },
                  {
                    id: "hebwoeu",
                    title: "Closing because all"
                  },
                  {
                    id: "mbnoenq",
                    title: "Better offer"
                  }
                ]
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "401": {
          description: "Authentication Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "404": {
          description: "Definition Not found",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/DefinitionNotFoundResp"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    },
    put: {
      operationId: "updateDefinition",
      summary: "updateDefinition",
      description: "Update Workflow Definition.",
      tags: ["Workflows"],
      parameters: [
        {
          in: "path",
          name: "definitionId",
          schema: {
            type: "string"
          },
          required: true,
          description: "Short uuid (length 8) to identify the Workflow Definition.",
          example: "7hj28a"
        }
      ],
      requestBody: {
        description: "Workflow Definition payload",
        required: true,
        content: {
          "application/json": {
            schema: {
              $ref: "#/components/schemas/WorkflowDefinition"
            },
            example: {
              id: "25n2k52ja",
              name: "Lead Qualification",
              dueDate: "2022-08-04T12:00:00.000Z",
              assignedTo: ["952802", "80225"],
              lastUpdateTime: "2021-08-04T21:13:50.373Z",
              creationTime: "2021-08-04T21:13:50.373Z",
              flow: [
                {
                  id: "5892na2",
                  name: "Initial Information Gathering",
                  order: 1,
                  type: "SECTION",
                  steps: [
                    {
                      id: "2hja82a",
                      name: "Call client and confirm address and product",
                      type: "STEP",
                      order: 1,
                      assignedTo: ["8988"]
                    },
                    {
                      id: "ga92ha2",
                      name: "Check product availability",
                      type: "STEP",
                      order: 2,
                      assignedTo: ["8988"]
                    },
                    {
                      id: "jga92ha",
                      name: "Send email confirming contact with the client",
                      type: "STEP",
                      order: 3,
                      assignedTo: ["8988"]
                    }
                  ]
                },
                {
                  id: "0a7g22a",
                  name: "Print and send catalog",
                  type: "STEP",
                  order: 2,
                  assignedTo: ["8988"]
                }
              ]
            }
          }
        }
      },
      responses: {
        "200": {
          description: "Success - if the definition is updated successfully",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/WorkflowDefinition"
              },
              example: {
                id: "25n2k52ja",
                name: "Lead Qualification",
                dueDate: "2022-08-04T12:00:00.000Z",
                assignedTo: ["952802", "80225"],
                lastUpdateTime: "2021-08-04T21:13:50.373Z",
                creationTime: "2021-08-04T21:13:50.373Z",
                flow: [
                  {
                    id: "5892na2",
                    name: "Initial Information Gathering",
                    order: 1,
                    type: "SECTION",
                    steps: [
                      {
                        id: "2hja82a",
                        name: "Call client and confirm address and product",
                        type: "STEP",
                        order: 1,
                        assignedTo: ["1"]
                      },
                      {
                        id: "ga92ha2",
                        name: "Check product availability",
                        type: "STEP",
                        order: 2,
                        assignedTo: ["56645"]
                      },
                      {
                        id: "jga92ha",
                        name: "Send email confirming contact with the client",
                        type: "STEP",
                        order: 3,
                        assignedTo: ["949923"]
                      }
                    ]
                  },
                  {
                    id: "0a7g22a",
                    name: "Print and send catalog",
                    type: "STEP",
                    order: 2,
                    assignedTo: ["156645"]
                  }
                ]
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "401": {
          description: "Authentication Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    },
    delete: {
      operationId: "deleteDefinition",
      summary: "deleteDefinition",
      description: "Delete Workflow Definition.",
      tags: ["Workflows"],
      parameters: [
        {
          in: "path",
          name: "definitionId",
          schema: {
            type: "string"
          },
          required: true,
          description: "Id of the definition to de deleted.",
          example: "CustomerRequest"
        }
      ],
      responses: {
        "204": {
          description: "Success - if the definition is deleted successfully"
        },
        "401": {
          description: "Failed to authenticate",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "404": {
          description: "No definition found"
        }
      }
    }
  },
  "/v1/workflows/closing-reasons": {
    get: {
      operationId: "getAllClosingReasons",
      summary: "getAllClosingReasons",
      description: "Get all Closing Reasons defined in the organization by default all Active.",
      parameters: [
        {
          in: "query",
          name: "includeInactive",
          schema: {
            type: "boolean"
          },
          required: false,
          description: "Filter Closing Reasons by status like active inactiv",
          example: true
        }
      ],
      tags: ["Closing Reason"],
      responses: {
        "200": {
          description: "Returns the entire catalog of closing reasons per organization",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ClosingReasons"
              }
            }
          }
        }
      }
    },
    post: {
      operationId: "createClosingReason",
      summary: "createClosingReason",
      description: "A created Closing Reason is stored for the organization and will be displayed in the library of reasons.",
      tags: ["Closing Reason"],
      requestBody: {
        description: "closing reason to store",
        required: true,
        content: {
          "application/json": {
            schema: {
              $ref: "#/components/schemas/ClosingReason"
            },
            example: {
              title: "better offer",
              description: "A customer closes the process because he found something better"
            }
          }
        }
      },
      responses: {
        "201": {
          description: "closing reason is stored successfully in the repository",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ClosingReason"
              }
            }
          }
        }
      }
    }
  },
  "/v2/workflows/closing-reasons/{reasonId}": {
    get: {
      operationId: "getClosingReason",
      summary: "getClosingReason",
      description: "Get specific closing reason by id from the organisation.",
      tags: ["Closing Reason"],
      parameters: [
        {
          in: "path",
          name: "reasonId",
          schema: {
            type: "string",
            example: "x739cew"
          },
          required: true,
          description: "unique id to identify the closing reason."
        }
      ],
      responses: {
        "200": {
          description: "Returns the closing reason",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ClosingReason"
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "403": {
          description: "Forbidden",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "404": {
          description: "Closing reason not found",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ClosingReasonNotFoundResp"
              }
            }
          }
        }
      }
    },
    patch: {
      operationId: "updateClosingReason",
      summary: "updateClosingReason",
      description: "Update an existing closing reason",
      tags: ["Closing Reason"],
      parameters: [
        {
          in: "path",
          name: "reasonId",
          schema: {
            type: "string",
            example: "x739cew"
          },
          required: true,
          description: "unique id to identify the closing reason."
        }
      ],
      requestBody: {
        description: "Updated closing reason fields",
        required: true,
        content: {
          "application/json": {
            schema: {
              $ref: "#/components/schemas/ClosingReason"
            }
          }
        }
      },
      responses: {
        "200": {
          description: "Closing reason updated successfully",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ClosingReason"
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "403": {
          description: "Forbidden",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "404": {
          description: "Closing reason not found",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ClosingReasonNotFoundResp"
              }
            }
          }
        }
      }
    },
    delete: {
      operationId: "deleteClosingReason",
      summary: "deleteClosingReason",
      description: "Permanently delete a closing reason (Using INACTIVE status is recommended instead)",
      tags: ["Closing Reason"],
      parameters: [
        {
          in: "path",
          name: "reasonId",
          schema: {
            type: "string",
            example: "x739cew"
          },
          required: true,
          description: "unique id to identify the closing reason."
        }
      ],
      responses: {
        "204": {
          description: "Closing reason deleted successfully"
        },
        "403": {
          description: "Forbidden",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "404": {
          description: "Closing reason not found",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ClosingReasonNotFoundResp"
              }
            }
          }
        }
      }
    }
  },
  "/v1/workflows/closing-reasons/{reasonId}": {
    get: {
      deprecated: true,
      operationId: "getClosingReasonV1",
      summary: "getClosingReasonV1",
      description: "Get specific closing reason by id from the organisation.",
      tags: ["Closing Reason"],
      parameters: [
        {
          in: "path",
          name: "reasonId",
          schema: {
            type: "string"
          },
          required: true,
          description: "uuid to identify the closing reason.",
          example: "-poOAPBa-jFZA_AWV3zN0"
        }
      ],
      responses: {
        "200": {
          description: "Returns the closing reason",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ClosingReason"
              },
              example: {
                id: "-poOAPBa-jFZA_AWV3zN0",
                title: "Closing due to example reason",
                status: "ACTIVE",
                lastUpdateTime: "2021-08-04T21:13:50.373Z",
                creationTime: "2021-08-04T21:13:50.373Z"
              }
            }
          }
        },
        "400": {
          description: "Validation Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "401": {
          description: "Authentication Errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "404": {
          description: "Closing reason not found",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ClosingReasonNotFoundResp"
              }
            }
          }
        },
        "500": {
          description: "Other errors",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    },
    patch: {
      operationId: "changeReasonStatus",
      summary: "changeReasonStatus",
      description: "Change the status of a Closing Reason (eg. ACTIVE to INACTIVE).",
      tags: ["Closing Reason"],
      parameters: [
        {
          in: "path",
          name: "reasonId",
          required: true,
          schema: {
            type: "string"
          }
        }
      ],
      requestBody: {
        description: "change the status of a closing reason",
        content: {
          "application/json": {
            schema: {
              $ref: "#/components/schemas/ChangeReasonStatusReq"
            }
          }
        }
      },
      responses: {
        "202": {
          description: "The status change was accepted"
        },
        "400": {
          description: "bad request",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        },
        "500": {
          description: "Internal server error",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ErrorResp"
              }
            }
          }
        }
      }
    }
  },
  "/v1/workflows/definitions/{definitionId}/closing-reasons": {
    get: {
      operationId: "getWorkflowClosingReasons",
      summary: "getWorkflowClosingReasons",
      description: "Returns all closing reasons defined for the workflow.",
      parameters: [
        {
          in: "path",
          name: "definitionId",
          schema: {
            type: "string"
          },
          required: true,
          description: "ID of a workflow definition",
          example: "fxcwfw"
        }
      ],
      tags: ["Workflows"],
      responses: {
        "200": {
          description: "Returns the entire catalog of closing reasons for a specific workflow",
          content: {
            "application/json": {
              schema: {
                $ref: "#/components/schemas/ClosingReasonsIds"
              }
            }
          }
        }
      }
    },
    patch: {
      operationId: "setWorkflowClosingReasons",
      summary: "setWorkflowClosingReasons",
      description: "Sets which closing reasons are defined for this workflow, based on the entire closing reasons catalog.",
      tags: ["Workflows"],
      parameters: [
        {
          in: "path",
          name: "definitionId",
          schema: {
            type: "string"
          },
          required: true,
          description: "ID of a workflow definition",
          example: 7889
        }
      ],
      requestBody: {
        description: "set all closing reasons for a specific definition",
        required: true,
        content: {
          "application/json": {
            schema: {
              $ref: "#/components/schemas/ClosingReasonsIds"
            }
          }
        }
      },
      responses: {
        "201": {
          description: "closing reasons are set for this workflow"
        }
      }
    }
  }
};
var components = {
  securitySchemes: {
    BearerAuth: {
      type: "http",
      scheme: "bearer",
      bearerFormat: "JWT"
    }
  },
  schemas: {
    FlowTemplateBase: {
      type: "object",
      required: ["name", "tasks", "edges"],
      properties: {
        id: {
          type: "string"
        },
        org_id: {
          type: "string"
        },
        name: {
          type: "string"
        },
        description: {
          type: "string"
        },
        trigger: {
          $ref: "#/components/schemas/Trigger"
        },
        enabled: {
          type: "boolean",
          description: "Whether the workflow is enabled or not",
          default: true
        },
        version: {
          $ref: "#/components/schemas/Version"
        },
        created_at: {
          type: "string",
          description: "ISO String Date & Time",
          example: "2021-04-27T12:01:13.000Z"
        },
        updated_at: {
          type: "string",
          description: "ISO String Date & Time",
          example: "2021-04-27T12:01:13.000Z"
        },
        due_date: {
          type: "string",
          example: "2021-04-27T12:00:00.000Z"
        },
        due_date_config: {
          $ref: "#/components/schemas/DueDateConfig"
        },
        assigned_to: {
          type: "array",
          items: {
            oneOf: [
              {
                type: "string"
              },
              {
                $ref: "#/components/schemas/VariableAssignment"
              }
            ]
          }
        },
        available_in_ecp: {
          type: "boolean",
          description: "Indicates whether this workflow is available for End Customer Portal or not. By default it's not."
        },
        additional_triggers: {
          type: "array",
          description: "Additional trigger configurations that can also start this flow. Useful for flows that should be startable via multiple methods (e.g., both automation AND manual).",
          items: {
            $ref: "#/components/schemas/Trigger"
          }
        },
        phases: {
          type: "array",
          items: {
            $ref: "#/components/schemas/Phase"
          }
        },
        tasks: {
          type: "array",
          items: {
            $ref: "#/components/schemas/Task"
          }
        },
        edges: {
          type: "array",
          items: {
            $ref: "#/components/schemas/Edge"
          }
        },
        closing_reasons: {
          type: "array",
          items: {
            $ref: "#/components/schemas/ClosingReason"
          }
        },
        entity_sync: {
          type: "array",
          items: {
            $ref: "#/components/schemas/EntitySync"
          }
        },
        taxonomies: {
          type: "array",
          items: {
            type: "string"
          },
          description: "Taxonomy ids that are associated with this workflow and used for filtering"
        },
        singleClosingReasonSelection: {
          type: "boolean",
          description: "Whether only a single closing reason can be selected"
        }
      }
    },
    FlowTemplate: {
      allOf: [
        {
          $ref: "#/components/schemas/FlowTemplateBase"
        },
        {
          type: "object",
          properties: {
            closing_reasons: {
              type: "array",
              items: {
                $ref: "#/components/schemas/ClosingReason"
              }
            }
          }
        }
      ]
    },
    Version: {
      type: "string",
      enum: ["v1", "v2", "v3"],
      description: "Version of the workflow schema.\n\n- `v1` \u2013 *Deprecated*. The initial version of workflows with limited structure and automation capabilities.  \n- `v2` \u2013 Linear workflows. Supports sequential task execution with basic automation triggers.  \n- `v3` \u2013 Advanced workflows. Adds support for branching logic (conditions), parallel paths, and enhanced automation features such as dynamic triggers and flow control.\n",
      example: 2
    },
    Trigger: {
      anyOf: [
        {
          $ref: "#/components/schemas/ManualTrigger"
        },
        {
          $ref: "#/components/schemas/AutomationTrigger"
        },
        {
          $ref: "#/components/schemas/JourneySubmissionTrigger"
        },
        {
          $ref: "#/components/schemas/JourneyAutomationTrigger"
        }
      ],
      example: {
        type: "automation",
        automation_id: "g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg"
      }
    },
    ManualTrigger: {
      type: "object",
      required: ["type"],
      properties: {
        id: {
          type: "string"
        },
        type: {
          type: "string",
          enum: ["manual"]
        },
        entity_schema: {
          type: "string"
        }
      }
    },
    AutomationTrigger: {
      type: "object",
      required: ["type"],
      properties: {
        id: {
          type: "string"
        },
        type: {
          type: "string",
          enum: ["automation"]
        },
        automation_id: {
          type: "string",
          description: "Id of the automation config that triggers this workflow"
        },
        trigger_config: {
          type: "array",
          items: {
            type: "object",
            required: ["type"],
            properties: {
              type: {
                type: "string",
                description: "The trigger type (e.g. entity_operation, activity)"
              },
              configuration: {
                type: "object",
                additionalProperties: true,
                description: "Trigger-specific configuration"
              }
            },
            additionalProperties: true
          },
          description: "Transient field. Trigger configurations for creating or updating the trigger automation flow. Each item follows the automation API trigger schema. Processed by the backend during create/update and stripped before storage.\n"
        }
      }
    },
    JourneyAutomationTrigger: {
      type: "object",
      required: ["type"],
      properties: {
        id: {
          type: "string"
        },
        type: {
          type: "string",
          enum: ["journey_automation"]
        },
        entity_schema: {
          type: "string",
          description: "Schema of the main entity where flow will be triggered. The entity will be picked from automation context."
        }
      }
    },
    JourneySubmissionTrigger: {
      type: "object",
      required: ["type", "journey_id"],
      properties: {
        id: {
          type: "string"
        },
        type: {
          type: "string",
          enum: ["journey_submission"]
        },
        journey_id: {
          type: "string",
          description: "ID of the journey that will trigger this flow"
        },
        journey_name: {
          type: "string",
          description: "Name of the journey that will trigger this flow"
        },
        automation_id: {
          type: "string"
        }
      }
    },
    CreateFlowTemplate: {
      allOf: [
        {
          $ref: "#/components/schemas/FlowTemplateBase"
        },
        {
          type: "object",
          properties: {
            closing_reasons: {
              type: "array",
              items: {
                type: "object",
                required: ["id"],
                properties: {
                  id: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      ]
    },
    SearchFlowTemplates: {
      type: "object",
      properties: {
        name: {
          type: "string"
        },
        definition_id: {
          type: "string"
        },
        trigger_type: {
          type: "string",
          enum: ["journey_submission", "manual", "automation"]
        },
        enabled: {
          type: "boolean"
        },
        from: {
          type: "integer"
        },
        size: {
          type: "integer"
        },
        sort_by: {
          type: "string",
          enum: ["created_at", "updated_at"],
          default: "updated_at"
        },
        sort_order: {
          type: "string",
          enum: ["asc", "desc"],
          default: "desc"
        }
      }
    },
    FlowTemplatesList: {
      type: "object",
      properties: {
        results: {
          type: "array",
          items: {
            $ref: "#/components/schemas/FlowTemplate"
          }
        }
      },
      required: ["results"]
    },
    FlowTemplateId: {
      type: "string",
      description: "Short unique id (length 8) to identify the Flow Template.",
      example: "7hj28akg"
    },
    Task: {
      anyOf: [
        {
          $ref: "#/components/schemas/ManualTask"
        },
        {
          $ref: "#/components/schemas/AutomationTask"
        },
        {
          $ref: "#/components/schemas/DecisionTask"
        },
        {
          $ref: "#/components/schemas/AiAgentTask"
        }
      ]
    },
    ManualTask: {
      allOf: [
        {
          $ref: "#/components/schemas/TaskBase"
        }
      ]
    },
    AutomationTask: {
      allOf: [
        {
          $ref: "#/components/schemas/TaskBase"
        },
        {
          type: "object",
          required: ["automation_config"],
          properties: {
            automation_config: {
              $ref: "#/components/schemas/AutomationConfig"
            },
            trigger_mode: {
              $ref: "#/components/schemas/TriggerMode"
            },
            schedule: {
              $ref: "#/components/schemas/ActionSchedule"
            },
            created_automatically: {
              type: "boolean",
              description: "Indicates whether this task was created automatically by journeys or manually by an user",
              default: false
            }
          }
        }
      ]
    },
    AutomationConfig: {
      type: "object",
      description: "Configuration for automation execution to run",
      properties: {
        flow_id: {
          type: "string",
          description: "Id of the configured automation to run"
        },
        action_config: {
          type: "object",
          required: ["type"],
          properties: {
            type: {
              type: "string",
              description: "The action type (e.g. send-email, trigger-workflow)"
            },
            config: {
              type: "object",
              additionalProperties: true,
              description: "Action-specific configuration"
            }
          },
          additionalProperties: true,
          description: "Transient field. The full automation action configuration following the automation API action schema. Processed by the backend during create/update and stripped before storage. When present without a flow_id, a new automation flow is created. When present with a flow_id, the existing automation flow is updated.\n"
        }
      }
    },
    AiAgentTask: {
      allOf: [
        {
          $ref: "#/components/schemas/TaskBase"
        },
        {
          type: "object",
          properties: {
            agent_config: {
              $ref: "#/components/schemas/AgentConfig"
            }
          }
        }
      ]
    },
    AgentConfig: {
      type: "object",
      description: "Configuration for AI Agent to run",
      required: ["agent_id"],
      properties: {
        agent_id: {
          type: "string",
          description: "Id of the configured AI Agent to run"
        }
      },
      additionalProperties: true
    },
    TriggerMode: {
      type: "string",
      enum: ["manual", "automatic"]
    },
    ActionSchedule: {
      anyOf: [
        {
          $ref: "#/components/schemas/ImmediateSchedule"
        },
        {
          $ref: "#/components/schemas/DelayedSchedule"
        },
        {
          $ref: "#/components/schemas/RelativeSchedule"
        }
      ]
    },
    ImmediateSchedule: {
      type: "object",
      properties: {
        mode: {
          enum: ["immediate"]
        }
      }
    },
    DelayedSchedule: {
      type: "object",
      required: ["mode", "duration", "unit"],
      properties: {
        mode: {
          enum: ["delayed"]
        },
        duration: {
          type: "number"
        },
        unit: {
          $ref: "#/components/schemas/TimeUnit"
        }
      }
    },
    RelativeSchedule: {
      type: "object",
      properties: {
        mode: {
          enum: ["relative"]
        },
        direction: {
          type: "string",
          enum: ["before", "after"]
        },
        duration: {
          type: "number"
        },
        unit: {
          $ref: "#/components/schemas/TimeUnit"
        },
        reference: {
          type: "object",
          required: ["id", "origin"],
          properties: {
            id: {
              type: "string",
              description: "The id of the entity / workflow / task, based on the origin of the schedule"
            },
            origin: {
              type: "string",
              enum: ["flow_started", "task_completed", "trigger_entity_attribute"]
            },
            schema: {
              type: "string",
              description: "The schema of the entity"
            },
            attribute: {
              type: "string",
              description: "An entity attribute that identifies a date / datetime"
            }
          }
        }
      },
      required: ["mode", "direction", "duration", "unit", "reference"]
    },
    DecisionTask: {
      allOf: [
        {
          $ref: "#/components/schemas/TaskBase"
        },
        {
          type: "object",
          properties: {
            trigger_mode: {
              $ref: "#/components/schemas/TriggerMode"
            },
            conditions: {
              type: "array",
              items: {
                $ref: "#/components/schemas/Condition"
              }
            },
            schedule: {
              anyOf: [
                {
                  $ref: "#/components/schemas/DelayedSchedule"
                },
                {
                  $ref: "#/components/schemas/RelativeSchedule"
                }
              ]
            },
            loop_config: {
              type: "object",
              properties: {
                loop_branch_id: {
                  type: "string",
                  description: "The id of the branch that will be looped"
                },
                exit_branch_id: {
                  type: "string",
                  description: "The id of the branch that will be used to exit the loop"
                },
                max_iterations: {
                  type: "integer",
                  description: "Maximum number of iterations for the loop branch",
                  default: 3,
                  minimum: 1,
                  maximum: 10
                }
              },
              required: ["loop_branch_id", "exit_branch_id", "max_iterations"]
            }
          },
          required: ["trigger_mode", "conditions"]
        }
      ]
    },
    TaskBase: {
      type: "object",
      properties: {
        id: {
          type: "string"
        },
        name: {
          type: "string"
        },
        description: {
          $ref: "#/components/schemas/StepDescription"
        },
        journey: {
          $ref: "#/components/schemas/StepJourney"
        },
        due_date: {
          type: "string",
          example: "2021-04-27T12:00:00.000Z"
        },
        due_date_config: {
          $ref: "#/components/schemas/DueDateConfig"
        },
        requirements: {
          type: "array",
          description: "requirements that need to be fulfilled in order to enable the task while flow instances are running",
          items: {
            $ref: "#/components/schemas/EnableRequirement"
          }
        },
        assigned_to: {
          type: "array",
          items: {
            oneOf: [
              {
                type: "string"
              },
              {
                $ref: "#/components/schemas/VariableAssignment"
              }
            ]
          }
        },
        ecp: {
          $ref: "#/components/schemas/ECPDetails"
        },
        installer: {
          $ref: "#/components/schemas/ECPDetails"
        },
        taxonomies: {
          type: "array",
          items: {
            type: "string"
          },
          description: "Taxonomy ids that are associated with this workflow and used for filtering"
        },
        phase_id: {
          type: "string"
        },
        task_type: {
          $ref: "#/components/schemas/TaskType"
        }
      },
      required: ["id", "name", "task_type"]
    },
    Phase: {
      type: "object",
      properties: {
        id: {
          type: "string"
        },
        name: {
          type: "string"
        },
        due_date: {
          type: "string",
          example: "2021-04-27T12:00:00.000Z"
        },
        due_date_config: {
          $ref: "#/components/schemas/DueDateConfig"
        },
        assigned_to: {
          type: "array",
          items: {
            oneOf: [
              {
                type: "string"
              },
              {
                $ref: "#/components/schemas/VariableAssignment"
              }
            ]
          }
        },
        taxonomies: {
          type: "array",
          items: {
            type: "string"
          },
          description: "Taxonomy ids that are associated with this workflow and used for filtering"
        }
      },
      required: ["id", "name"]
    },
    VariableAssignment: {
      type: "object",
      description: "Represents a variable assignment with its expression and optional resolved value. Used for dynamic user assignments that get resolved during workflow execution.",
      properties: {
        variable: {
          type: "string",
          description: 'The variable expression, e.g., "{{entity.owner}}"',
          example: "{{entity.owner}}"
        },
        value: {
          type: "string",
          description: "The resolved value after variable evaluation (populated during execution)",
          example: "user_12345"
        }
      },
      required: ["variable"]
    },
    TaskType: {
      type: "string",
      enum: ["MANUAL", "AUTOMATION", "DECISION", "AI_AGENT"]
    },
    Edge: {
      type: "object",
      properties: {
        id: {
          type: "string"
        },
        from_id: {
          type: "string"
        },
        to_id: {
          type: "string"
        },
        condition_id: {
          type: "string"
        },
        none_met: {
          type: "boolean",
          description: "Indicates a default case for a decision task. Only decision task edges can have this field and the flow advances using this edge if no conditions are met."
        }
      },
      required: ["id", "from_id", "to_id"]
    },
    Condition: {
      type: "object",
      properties: {
        id: {
          type: "string"
        },
        branch_name: {
          type: "string",
          description: "The name of the branch",
          maxLength: 255,
          example: "Branch 1"
        },
        logical_operator: {
          type: "string",
          enum: ["AND", "OR"]
        },
        statements: {
          type: "array",
          items: {
            $ref: "#/components/schemas/Statement"
          }
        }
      },
      required: ["id", "branch_name", "logical_operator", "statements"]
    },
    Statement: {
      type: "object",
      properties: {
        id: {
          type: "string"
        },
        source: {
          $ref: "#/components/schemas/EvaluationSource"
        },
        operator: {
          $ref: "#/components/schemas/Operator"
        },
        values: {
          type: "array",
          items: {
            type: "string"
          }
        }
      },
      required: ["id", "source", "operator", "values"]
    },
    EvaluationSource: {
      type: "object",
      properties: {
        id: {
          type: "string",
          description: "The id of the action or trigger"
        },
        origin: {
          type: "string",
          enum: ["trigger", "action"]
        },
        origin_type: {
          type: "string",
          enum: ["entity", "workflow", "journey_block"]
        },
        schema: {
          type: "string"
        },
        attribute: {
          type: "string"
        },
        attribute_type: {
          type: "string",
          enum: [
            "string",
            "text",
            "number",
            "boolean",
            "date",
            "datetime",
            "tags",
            "country",
            "email",
            "phone",
            "product",
            "price",
            "status",
            "relation",
            "multiselect",
            "select",
            "radio",
            "relation_user",
            "purpose",
            "label",
            "message_email_address"
          ]
        },
        attribute_repeatable: {
          type: "boolean"
        },
        attribute_operation: {
          enum: ["all", "updated", "added", "deleted"]
        },
        attribute_sub_field: {
          type: "string",
          description: "For complex attribute types, specifies which sub-field to extract (e.g., 'address', 'name', 'email_type')"
        }
      }
    },
    Operator: {
      type: "string",
      enum: [
        "equals",
        "not_equals",
        "any_of",
        "none_of",
        "contains",
        "not_contains",
        "starts_with",
        "ends_with",
        "greater_than",
        "less_than",
        "greater_than_or_equals",
        "less_than_or_equals",
        "is_empty",
        "is_not_empty"
      ]
    },
    DueDateConfig: {
      description: "Set due date for the task based on a dynamic condition",
      type: "object",
      properties: {
        duration: {
          type: "number"
        },
        unit: {
          $ref: "#/components/schemas/TimeUnit"
        },
        type: {
          type: "string",
          enum: ["WORKFLOW_STARTED", "TASK_FINISHED", "PHASE_FINISHED"]
        },
        task_id: {
          type: "string"
        },
        phase_id: {
          type: "string"
        }
      },
      required: ["duration", "unit", "type"]
    },
    TimeUnit: {
      type: "string",
      enum: ["minutes", "hours", "days", "weeks", "months"]
    },
    EnableRequirement: {
      description: "describe the requirement for a task to be enabled",
      type: "object",
      properties: {
        task_id: {
          type: "string",
          description: "The id of the task that it points to"
        },
        phase_id: {
          type: "string",
          description: "The id of the phase that it points to"
        },
        when: {
          type: "string",
          enum: ["TASK_FINISHED", "PHASE_FINISHED"]
        }
      },
      required: ["when"]
    },
    WorkflowDefinition: {
      type: "object",
      properties: {
        id: {
          type: "string"
        },
        name: {
          type: "string"
        },
        description: {
          type: "string"
        },
        creationTime: {
          type: "string",
          description: "ISO String Date & Time",
          example: "2021-04-27T12:01:13.000Z"
        },
        enabled: {
          type: "boolean",
          description: "Whether the workflow is enabled or not",
          default: true
        },
        lastUpdateTime: {
          type: "string",
          description: "ISO String Date & Time",
          example: "2021-04-27T12:01:13.000Z"
        },
        dueDate: {
          type: "string",
          example: "2021-04-27T12:00:00.000Z"
        },
        dynamicDueDate: {
          $ref: "#/components/schemas/DynamicDueDate"
        },
        userIds: {
          type: "array",
          items: {
            type: "number"
          },
          deprecated: true,
          description: "This field is deprecated. Please use assignedTo"
        },
        assignedTo: {
          type: "array",
          items: {
            type: "string"
          }
        },
        enableECPWorkflow: {
          type: "boolean",
          description: "Indicates whether this workflow is available for End Customer Portal or not. By default it's not."
        },
        flow: {
          type: "array",
          items: {
            anyOf: [
              {
                $ref: "#/components/schemas/Section"
              },
              {
                $ref: "#/components/schemas/Step"
              }
            ]
          }
        },
        closingReasons: {
          type: "array",
          items: {
            $ref: "#/components/schemas/ClosingReasonId"
          }
        },
        updateEntityAttributes: {
          type: "array",
          items: {
            $ref: "#/components/schemas/UpdateEntityAttributes"
          }
        },
        taxonomies: {
          type: "array",
          items: {
            type: "string"
          },
          description: "Taxonomy ids that are associated with this workflow and used for filtering"
        },
        singleClosingReasonSelection: {
          type: "boolean",
          description: "Whether only a single closing reason can be selected"
        }
      },
      required: ["name", "flow"]
    },
    Step: {
      type: "object",
      description: "Action that needs to be done in a Workflow",
      properties: {
        id: {
          type: "string"
        },
        name: {
          type: "string"
        },
        description: {
          $ref: "#/components/schemas/StepDescription"
        },
        executionType: {
          $ref: "#/components/schemas/StepType"
        },
        automationConfig: {
          type: "object",
          properties: {
            flowId: {
              type: "string",
              description: "Id of the configured automation to run"
            }
          },
          required: ["flowId"]
        },
        journey: {
          $ref: "#/components/schemas/StepJourney"
        },
        order: {
          type: "number"
        },
        dueDate: {
          type: "string",
          example: "2021-04-27T12:00:00.000Z"
        },
        dynamicDueDate: {
          $ref: "#/components/schemas/DynamicDueDate"
        },
        userIds: {
          type: "array",
          items: {
            type: "number"
          },
          deprecated: true,
          description: "This field is deprecated. Please use assignedTo"
        },
        requirements: {
          type: "array",
          description: "requirements that need to be fulfilled in order to enable the step execution",
          items: {
            $ref: "#/components/schemas/StepRequirement"
          }
        },
        assignedTo: {
          type: "array",
          items: {
            type: "string"
          }
        },
        type: {
          $ref: "#/components/schemas/ItemType"
        },
        ecp: {
          $ref: "#/components/schemas/ECPDetails"
        },
        installer: {
          $ref: "#/components/schemas/ECPDetails"
        },
        taxonomies: {
          type: "array",
          items: {
            type: "string"
          },
          description: "Taxonomy ids that are associated with this workflow and used for filtering"
        }
      },
      required: ["name", "order", "type"]
    },
    Section: {
      type: "object",
      description: "A group of Steps that define the progress of the Workflow",
      properties: {
        id: {
          type: "string"
        },
        name: {
          type: "string"
        },
        order: {
          type: "number"
        },
        type: {
          $ref: "#/components/schemas/ItemType"
        },
        dueDate: {
          type: "string",
          example: "2021-04-27T12:00:00.000Z"
        },
        dynamicDueDate: {
          $ref: "#/components/schemas/DynamicDueDate"
        },
        assignedTo: {
          type: "array",
          items: {
            type: "string"
          }
        },
        steps: {
          type: "array",
          items: {
            $ref: "#/components/schemas/Step"
          }
        },
        taxonomies: {
          type: "array",
          items: {
            type: "string"
          },
          description: "Taxonomy ids that are associated with this workflow and used for filtering"
        }
      },
      required: ["name", "order", "type", "steps"]
    },
    TriggerType: {
      type: "string",
      enum: ["MANUAL", "AUTOMATIC"]
    },
    ItemType: {
      type: "string",
      enum: ["STEP", "SECTION"]
    },
    StepType: {
      type: "string",
      enum: ["MANUAL", "AUTOMATION"]
    },
    StepJourney: {
      type: "object",
      properties: {
        id: {
          type: "string"
        },
        journeyId: {
          type: "string"
        },
        name: {
          type: "string"
        },
        complete_task_automatically: {
          type: "boolean",
          default: true,
          description: "If true, the task be auto completed when the journey is completed. By default it is true."
        }
      }
    },
    ECPDetails: {
      type: "object",
      description: "Details regarding ECP for the workflow step",
      properties: {
        enabled: {
          type: "boolean"
        },
        label: {
          type: "string"
        },
        description: {
          type: "string"
        },
        journey: {
          $ref: "#/components/schemas/StepJourney"
        }
      }
    },
    StepDescription: {
      type: "object",
      description: "Longer information regarding Task",
      properties: {
        enabled: {
          type: "boolean"
        },
        value: {
          type: "string"
        }
      }
    },
    MaxAllowedLimit: {
      type: "object",
      properties: {
        currentNoOfWorkflows: {
          type: "number"
        },
        maxAllowed: {
          type: "number"
        }
      }
    },
    DefinitionNotFoundResp: {
      description: "Definition could be not found",
      properties: {
        message: {
          type: "string"
        }
      }
    },
    ClosingReasonNotFoundResp: {
      description: "Closing reason could be not found",
      properties: {
        message: {
          type: "string"
        }
      }
    },
    ChangeReasonStatusReq: {
      type: "object",
      properties: {
        status: {
          $ref: "#/components/schemas/ClosingReasonsStatus"
        }
      },
      required: ["status"]
    },
    ClosingReasons: {
      type: "object",
      properties: {
        reasons: {
          type: "array",
          items: {
            $ref: "#/components/schemas/ClosingReason"
          }
        }
      },
      required: ["reasons"]
    },
    ClosingReason: {
      type: "object",
      description: "One Closing reason for a workflow",
      required: ["title", "status"],
      properties: {
        id: {
          type: "string",
          readOnly: true
        },
        title: {
          type: "string"
        },
        status: {
          $ref: "#/components/schemas/ClosingReasonsStatus"
        },
        lastUpdateTime: {
          type: "string",
          readOnly: true
        },
        creationTime: {
          type: "string",
          readOnly: true
        }
      }
    },
    ClosingReasonsStatus: {
      type: "string",
      enum: ["ACTIVE", "INACTIVE"]
    },
    ClosingReasonsIds: {
      type: "object",
      properties: {
        reasons: {
          type: "array",
          items: {
            $ref: "#/components/schemas/ClosingReasonId"
          }
        }
      },
      required: ["reasons"]
    },
    ClosingReasonId: {
      type: "object",
      properties: {
        id: {
          type: "string",
          example: "x739cew"
        }
      },
      required: ["id"]
    },
    ErrorResp: {
      type: "object",
      properties: {
        message: {
          type: "string"
        }
      }
    },
    UpdateEntityAttributes: {
      type: "object",
      properties: {
        source: {
          type: "string",
          enum: ["workflow_status", "current_section", "current_step"]
        },
        target: {
          type: "object",
          properties: {
            entitySchema: {
              type: "string",
              example: "opportunity"
            },
            entityAttribute: {
              type: "string",
              example: "my_status"
            }
          },
          required: ["entitySchema", "entityAttribute"]
        }
      },
      required: ["source", "target"]
    },
    EntitySync: {
      type: "object",
      properties: {
        trigger: {
          type: "object",
          description: "Trigger configuration that determines when entity sync occurs.\nContains the event type and optional filter to target specific tasks/phases.\n",
          required: ["event"],
          properties: {
            event: {
              type: "string",
              description: "Event or condition that triggers the entity sync.\nDirect triggers match EventBridge event names (PascalCase).\nStatus triggers are deduced from event + entity status combination.\n",
              enum: [
                "FlowStarted",
                "FlowCompleted",
                "FlowCancelled",
                "FlowReopened",
                "FlowDeleted",
                "FlowAssigned",
                "FlowDueDateChanged",
                "FlowContextsChanged",
                "TaskUpdated",
                "CurrTaskChanged",
                "TaskCompleted",
                "TaskSkipped",
                "TaskMarkedInProgress",
                "TaskMarkedOnHold",
                "PhaseUpdated",
                "PhaseCompleted",
                "PhaseSkipped",
                "PhaseMarkedInProgress"
              ]
            },
            filter: {
              type: "object",
              description: "Optional filter to target specific tasks or phases.\nSpecify either task_template_id OR phase_template_id (mutually exclusive).\nIf omitted, trigger applies to all tasks/phases.\n",
              properties: {
                task_template_id: {
                  type: "string",
                  description: "Target a specific task by its template ID (stable across executions)"
                },
                phase_template_id: {
                  type: "string",
                  description: "Target a specific phase by its template ID (stable across executions)"
                }
              }
            }
          }
        },
        value: {
          type: "object",
          properties: {
            source: {
              type: "string",
              enum: [
                "workflow_name",
                "workflow_status",
                "workflow_assigned_to",
                "task_name",
                "task_status",
                "task_assigned_to",
                "phase_name",
                "phase_status",
                "phase_assigned_to",
                "custom_value"
              ]
            },
            value: {
              type: "string"
            }
          },
          required: ["source"]
        },
        target: {
          type: "object",
          properties: {
            entitySchema: {
              type: "string",
              example: "opportunity"
            },
            entityAttribute: {
              type: "string",
              example: "title"
            }
          },
          required: ["entitySchema", "entityAttribute"]
        }
      },
      example: {
        trigger: {
          event: "FlowStarted"
        },
        target: {
          entitySchema: "opportunity",
          entityAttribute: "title"
        },
        value: {
          source: "workflow_name"
        }
      },
      required: ["trigger", "target", "value"]
    },
    DynamicDueDate: {
      description: "set a Duedate for a step then a specific",
      type: "object",
      properties: {
        numberOfUnits: {
          type: "number"
        },
        timePeriod: {
          $ref: "#/components/schemas/TimeUnit"
        },
        actionTypeCondition: {
          type: "string",
          enum: ["WORKFLOW_STARTED", "STEP_CLOSED", "PHASE_FINISHED"]
        },
        stepId: {
          type: "string"
        },
        phaseId: {
          type: "string"
        }
      },
      required: ["numberOfUnits", "timePeriod", "actionTypeCondition"]
    },
    StepRequirement: {
      description: "describe the requirement for step enablement",
      type: "object",
      properties: {
        definitionId: {
          type: "string"
        },
        type: {
          $ref: "#/components/schemas/ItemType"
        },
        condition: {
          type: "string",
          enum: ["CLOSED"]
        }
      },
      required: ["definitionId", "type", "condition"]
    },
    FlowTemplateExport: {
      allOf: [
        {
          $ref: "#/components/schemas/FlowTemplate"
        },
        {
          type: "object",
          properties: {
            _resolved_automations: {
              type: "object",
              description: "Map of automation_id to full AutomationFlow object. Null values indicate automations that could not be resolved.",
              additionalProperties: {
                type: "object"
              }
            }
          }
        }
      ]
    },
    FlowTemplateImportResult: {
      type: "object",
      properties: {
        flow: {
          $ref: "#/components/schemas/FlowTemplate"
        },
        _id_mappings: {
          type: "object",
          description: "Maps old IDs to new IDs for cross-referencing by callers (e.g. blueprint service)",
          properties: {
            flow_id: {
              type: "object",
              properties: {
                old: {
                  type: "string"
                },
                new: {
                  type: "string"
                }
              }
            },
            task_ids: {
              type: "object",
              additionalProperties: {
                type: "string"
              },
              description: "Map of old_task_id to new_task_id"
            },
            automation_ids: {
              type: "object",
              additionalProperties: {
                type: "string"
              },
              description: "Map of old_automation_id to new_automation_id"
            }
          }
        }
      }
    }
  }
};
var workflow_definition_default = {
  openapi,
  info,
  servers,
  security,
  paths,
  components
};








exports.components = components; exports.default = workflow_definition_default; exports.info = info; exports.openapi = openapi; exports.paths = paths; exports.security = security; exports.servers = servers;
