{
  "openapi": "3.0.4",
  "info": {
    "title": "Workflow Fast API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.mercadoe.com"
    }
  ],
  "paths": {
    "/v1/document-flows/{documentFlowId}/rules/{ruleId}/approvals": {
      "post": {
        "tags": [
          "Approvals"
        ],
        "summary": "Create an approval line within a rule",
        "description": "Adds a new approval line (rule line) to an existing rule of a document flow group.\nAn approval line defines who must approve and at which level inside the rule.",
        "parameters": [
          {
            "name": "documentFlowId",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "description": "Identifier of the rule within the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApprovalCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApprovalResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Approvals"
        ],
        "summary": "Update an approval line",
        "description": "Updates an existing approval line (rule line) of a rule, such as its approvers\nor the approval level it belongs to.",
        "parameters": [
          {
            "name": "documentFlowId",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "description": "Identifier of the rule within the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateApprovalCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateApprovalResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Approvals"
        ],
        "summary": "Get all approval lines within a rule",
        "description": "Returns every approval line (rule line) defined for the given rule, including\ntheir approvers and approval levels.",
        "parameters": [
          {
            "name": "documentFlowId",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "description": "Identifier of the rule within the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetApprovalLinesResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/document-flows/{documentFlowId}/rules/{ruleId}/approvals/{approvalLineId}": {
      "delete": {
        "tags": [
          "Approvals"
        ],
        "summary": "Delete an approval line",
        "description": "Removes an approval line (rule line) from a rule. The rule itself and its other\napproval lines are kept.",
        "parameters": [
          {
            "name": "documentFlowId",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "description": "Identifier of the rule within the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "approvalLineId",
            "in": "path",
            "description": "Identifier of the approval line (rule line).",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteApprovalResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Approvals"
        ],
        "summary": "Get an approval line by id",
        "description": "Returns a single approval line (rule line) of a rule, identified by its id.",
        "parameters": [
          {
            "name": "documentFlowId",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "description": "Identifier of the rule within the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "approvalLineId",
            "in": "path",
            "description": "Identifier of the approval line (rule line).",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetApprovalByIdResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/document-flows/{documentFlowId}/rules/conditions": {
      "get": {
        "tags": [
          "Conditions"
        ],
        "summary": "List conditions of a document flow group",
        "description": "Returns the paged list of conditions used by the rules of the given document flow\ngroup. Conditions define the criteria that determine which rule applies to a document.",
        "parameters": [
          {
            "name": "documentFlowId",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResult`1"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/document-flows": {
      "post": {
        "tags": [
          "Document Flows"
        ],
        "summary": "Create a document flow group",
        "description": "Creates a new document flow group. If the new group is active, the currently\nactive group for the same process is automatically deactivated.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDocumentFlowCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateDocumentFlowResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Document Flows"
        ],
        "summary": "Update a document flow group",
        "description": "Allows changing name, default behavior, approving users and active state.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDocumentFlowCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateDocumentFlowResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Document Flows"
        ],
        "summary": "List document flow groups",
        "description": "Returns the paged list of all document flow groups available for the current tenant.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResult`12"
                }
              }
            }
          }
        }
      }
    },
    "/v1/document-flows/{id}": {
      "delete": {
        "tags": [
          "Document Flows"
        ],
        "summary": "Delete a document flow group",
        "description": "Deletes the group with all nested rules, levels, approvers and conditions.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteDocumentFlowResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Document Flows"
        ],
        "summary": "Get a document flow group by id",
        "description": "Returns a single document flow group, including its rules, levels, approvers and conditions.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetDocumentFlowByIdResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/document-flows/process-types/{processTypeId}": {
      "get": {
        "tags": [
          "Document Flows"
        ],
        "summary": "List document flow groups by process type",
        "description": "Returns the paged list of document flow groups associated with the given process type.",
        "parameters": [
          {
            "name": "processTypeId",
            "in": "path",
            "description": "Identifier of the process type.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResult`14"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/external-pendencies/resolve": {
      "post": {
        "tags": [
          "External Pendencies"
        ],
        "summary": "Resolve an external pendency",
        "description": "Approves or refuses an external pendency on behalf of an external user.\nThe action is defined by the RuleType field of the request body: 1 = approve, 2 = refuse.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveExternalPendencyCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResolveExternalPendencyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/document-flows/{documentFlowId}/rules": {
      "post": {
        "tags": [
          "Rules"
        ],
        "summary": "Create a rule within a document flow group",
        "description": "Adds a new rule to an existing document flow group, including its approval levels\nand conditions. Conditions and levels are defined at creation time.",
        "parameters": [
          {
            "name": "documentFlowId",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRuleCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateRuleResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/document-flows/{documentFlowId}/rules/{ruleId}": {
      "put": {
        "tags": [
          "Rules"
        ],
        "summary": "Update a rule",
        "description": "Allows changing rule name and active state only. Levels and conditions\ndefined at creation cannot be added or removed.",
        "parameters": [
          {
            "name": "documentFlowId",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "description": "Identifier of the rule within the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRuleCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateRuleResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Rules"
        ],
        "summary": "Delete a rule",
        "description": "Deletes the rule with all nested conditions and approval levels.",
        "parameters": [
          {
            "name": "documentFlowId",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "description": "Identifier of the rule within the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteRuleResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Rules"
        ],
        "summary": "Get a rule by id",
        "description": "Returns a single rule of a document flow group, including its conditions and approval levels.",
        "parameters": [
          {
            "name": "documentFlowId",
            "in": "path",
            "description": "Identifier of the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "description": "Identifier of the rule within the document flow group.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetRuleByIdResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ApprovalApprovingInput": {
        "type": "object",
        "properties": {
          "user": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "role": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "userLogin": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ApprovalConditionInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      },
      "ApprovalLevel": {
        "type": "object",
        "properties": {
          "level": {
            "type": "integer",
            "format": "int32"
          },
          "approvalLimit": {
            "type": "number",
            "format": "double"
          },
          "erpIntegrationAfterLevelApproval": {
            "type": "boolean"
          },
          "approvers": {
            "$ref": "#/components/schemas/Approvers"
          }
        },
        "additionalProperties": false
      },
      "ApprovalLevelInput": {
        "type": "object",
        "properties": {
          "level": {
            "type": "integer",
            "format": "int32"
          },
          "approvalLimit": {
            "type": "number",
            "format": "double"
          },
          "approvers": {
            "$ref": "#/components/schemas/ApprovalApprovingInput"
          }
        },
        "additionalProperties": false
      },
      "ApprovalSummary": {
        "type": "object",
        "properties": {
          "approvalLineId": {
            "type": "integer",
            "format": "int64"
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Condition"
            }
          },
          "levels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalLevel"
            }
          }
        },
        "additionalProperties": false
      },
      "ApprovalType": {
        "enum": [
          "LevelBased",
          "AutoApprove",
          "AutoRefuse"
        ],
        "type": "string"
      },
      "Approvers": {
        "type": "object",
        "properties": {
          "user": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "role": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "userLogin": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "Condition": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "valueId": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CreateApprovalCommand": {
        "type": "object",
        "properties": {
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalConditionInput"
            }
          },
          "levels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalLevelInput"
            }
          }
        },
        "additionalProperties": false
      },
      "CreateApprovalResponse": {
        "type": "object",
        "properties": {
          "approvalLineIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            }
          }
        },
        "additionalProperties": false
      },
      "CreateDocumentFlowCommand": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "defaultBehavior": {
            "type": "integer",
            "format": "int32"
          },
          "processId": {
            "type": "integer",
            "format": "int32"
          },
          "isActive": {
            "type": "boolean"
          },
          "approvers": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            },
            "nullable": true
          },
          "approverLogins": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateDocumentFlowResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "CreateRuleCommand": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "notifyErpOnApproval": {
            "type": "boolean"
          },
          "erpIntegrationBeforeLevelApproval": {
            "type": "boolean"
          },
          "processId": {
            "type": "integer",
            "format": "int32"
          },
          "ruleType": {
            "type": "integer",
            "format": "int32"
          },
          "approvalType": {
            "$ref": "#/components/schemas/ApprovalType"
          },
          "isAutomaticDecision": {
            "type": "boolean"
          },
          "levels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RuleLevels"
            }
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RuleConditions"
            }
          }
        },
        "additionalProperties": false
      },
      "CreateRuleResponse": {
        "type": "object",
        "properties": {
          "ruleId": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "CreatedInfo": {
        "type": "object",
        "properties": {
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "createdBy": {
            "type": "string"
          },
          "createdById": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "DeleteApprovalResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "DeleteDocumentFlowResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "DeleteRuleResponse": {
        "type": "object",
        "properties": {
          "ruleId": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "DocumentFlowApprover": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "DocumentFlowRuleSummary": {
        "type": "object",
        "properties": {
          "ruleId": {
            "type": "integer",
            "format": "int64"
          },
          "description": {
            "type": "string"
          },
          "totalLevels": {
            "type": "integer",
            "format": "int32"
          },
          "totalConditions": {
            "type": "integer",
            "format": "int32"
          },
          "order": {
            "type": "integer",
            "format": "int32"
          },
          "totalApprovals": {
            "type": "integer",
            "format": "int32"
          },
          "isActive": {
            "type": "boolean"
          },
          "isAutomaticDecision": {
            "type": "boolean"
          },
          "hasErpIntegration": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "GetApprovalByIdResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "approvalType": {
            "type": "integer",
            "format": "int32"
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Condition"
            }
          },
          "levels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalLevel"
            }
          }
        },
        "additionalProperties": false
      },
      "GetApprovalLinesResponse": {
        "type": "object",
        "properties": {
          "approvalType": {
            "type": "integer",
            "format": "int32"
          },
          "approvals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalSummary"
            }
          }
        },
        "additionalProperties": false
      },
      "GetConditionsByDocumentFlowIdResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "processId": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "operators": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetConditionsByDocumentFlowIdValueResponse"
            }
          }
        },
        "additionalProperties": false
      },
      "GetConditionsByDocumentFlowIdValueResponse": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "GetDocumentFlowByIdResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "defaultBehavior": {
            "type": "integer",
            "format": "int32"
          },
          "isActive": {
            "type": "boolean"
          },
          "changeDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "changedBy": {
            "type": "string"
          },
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "createdBy": {
            "type": "string"
          },
          "process": {
            "$ref": "#/components/schemas/ProcessInfo"
          },
          "approvers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentFlowApprover"
            }
          },
          "rules": {
            "$ref": "#/components/schemas/PagedResult`13"
          }
        },
        "additionalProperties": false
      },
      "GetDocumentFlowsByProcessTypeResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "defaultBehavior": {
            "type": "integer",
            "format": "int32"
          },
          "isActive": {
            "type": "boolean"
          },
          "changeDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "changedBy": {
            "type": "string"
          },
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "createdBy": {
            "type": "string"
          },
          "process": {
            "$ref": "#/components/schemas/ProcessInfo"
          },
          "approvers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentFlowApprover"
            }
          },
          "rules": {
            "$ref": "#/components/schemas/PagedResult`13"
          }
        },
        "additionalProperties": false
      },
      "GetRuleByIdResponse": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "notifyErpOnApproval": {
            "type": "boolean"
          },
          "erpIntegrationBeforeLevelApproval": {
            "type": "boolean"
          },
          "processId": {
            "type": "integer",
            "format": "int32"
          },
          "ruleType": {
            "type": "integer",
            "format": "int32"
          },
          "approvalType": {
            "$ref": "#/components/schemas/ApprovalType"
          },
          "isAutomaticDecision": {
            "type": "boolean"
          },
          "created": {
            "$ref": "#/components/schemas/CreatedInfo"
          },
          "lastChange": {
            "$ref": "#/components/schemas/LastChangeInfo"
          },
          "approvals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalSummary"
            }
          }
        },
        "additionalProperties": false
      },
      "LastChangeInfo": {
        "type": "object",
        "properties": {
          "changeDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "changedBy": {
            "type": "string"
          },
          "changedById": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "PagedResult`1": {
        "type": "object",
        "properties": {
          "totalRecords": {
            "type": "integer",
            "format": "int32"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetConditionsByDocumentFlowIdResponse"
            }
          }
        },
        "additionalProperties": false
      },
      "PagedResult`12": {
        "type": "object",
        "properties": {
          "totalRecords": {
            "type": "integer",
            "format": "int32"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetDocumentFlowByIdResponse"
            }
          }
        },
        "additionalProperties": false
      },
      "PagedResult`13": {
        "type": "object",
        "properties": {
          "totalRecords": {
            "type": "integer",
            "format": "int32"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentFlowRuleSummary"
            }
          }
        },
        "additionalProperties": false
      },
      "PagedResult`14": {
        "type": "object",
        "properties": {
          "totalRecords": {
            "type": "integer",
            "format": "int32"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetDocumentFlowsByProcessTypeResponse"
            }
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": {}
      },
      "ProcessInfo": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ResolveExternalPendencyCommand": {
        "type": "object",
        "properties": {
          "processType": {
            "type": "integer",
            "format": "int32"
          },
          "document": {
            "type": "integer",
            "format": "int32"
          },
          "ruleType": {
            "type": "integer",
            "format": "int32"
          },
          "reason": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ResolveExternalPendencyResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "RuleApprovers": {
        "type": "object",
        "properties": {
          "roleIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            }
          },
          "userIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            }
          },
          "userLogins": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "RuleConditions": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      },
      "RuleLevels": {
        "type": "object",
        "properties": {
          "level": {
            "type": "integer",
            "format": "int32"
          },
          "approvalLimit": {
            "type": "number",
            "format": "double"
          },
          "erpIntegrationAfterLevelApproval": {
            "type": "boolean"
          },
          "approvers": {
            "$ref": "#/components/schemas/RuleApprovers"
          }
        },
        "additionalProperties": false
      },
      "UpdateApprovalCommand": {
        "type": "object",
        "properties": {
          "approvalLineId": {
            "type": "integer",
            "format": "int64"
          },
          "approvalType": {
            "type": "integer",
            "format": "int32"
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Condition"
            }
          },
          "levels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalLevel"
            }
          }
        },
        "additionalProperties": false
      },
      "UpdateApprovalResponse": {
        "type": "object",
        "properties": {
          "approvalLineId": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "UpdateDocumentFlowCommand": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "defaultBehavior": {
            "type": "integer",
            "format": "int32"
          },
          "isActive": {
            "type": "boolean"
          },
          "approvers": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            }
          },
          "approverLogins": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateDocumentFlowResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "UpdateRuleCommand": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "UpdateRuleResponse": {
        "type": "object",
        "properties": {
          "ruleId": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "description": "Please enter your JWT (Without the 'Bearer' word in the beginning).",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Approvals"
    },
    {
      "name": "Conditions"
    },
    {
      "name": "Document Flows"
    },
    {
      "name": "External Pendencies"
    },
    {
      "name": "Rules"
    }
  ]
}