---
openapi: 3.1.0
tags:
- name: Auth Data Sync
  description: Internal auth data synchronization event endpoints
- name: Reference Data
  description: "Reference data management endpoints for users, role groups, and organizations"
- name: State Machine
  description: Task state transition and task creation operations
- name: Task Configuration
  description: Operations related to task and engine configurations
- name: Task Definition
  description: Operations related to manual task definitions and assignment
- name: Task Report
  description: Reporting endpoints for task definitions and TAT analytics
- name: User Working
  description: Endpoints for user online/offline presence status
components:
  securitySchemes:
    OrgId:
      type: apiKey
      name: x-api-gw-organization-uuid
      in: header
    UserId:
      type: apiKey
      name: x-api-gw-user-uuid
      in: header
  schemas:
    ApiPageResponseAppUser:
      type: object
      properties:
        message:
          type: string
        page:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        response:
          type: array
          items:
            $ref: "#/components/schemas/AppUser"
    ApiPageResponseBranchResponse:
      type: object
      properties:
        message:
          type: string
        page:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        response:
          type: array
          items:
            $ref: "#/components/schemas/BranchResponse"
    ApiPageResponseOrgResponse:
      type: object
      properties:
        message:
          type: string
        page:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        response:
          type: array
          items:
            $ref: "#/components/schemas/OrgResponse"
    ApiPageResponseRoleGroupResponse:
      type: object
      properties:
        message:
          type: string
        page:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        response:
          type: array
          items:
            $ref: "#/components/schemas/RoleGroupResponse"
    ApiPageResponseTaskConfigResponse:
      type: object
      properties:
        message:
          type: string
        page:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        response:
          type: array
          items:
            $ref: "#/components/schemas/TaskConfigResponse"
    ApiPageResponseTaskDefinitionResponse:
      type: object
      properties:
        message:
          type: string
        page:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        response:
          type: array
          items:
            $ref: "#/components/schemas/TaskDefinitionResponse"
    ApiPageResponseTaskDefinitionView:
      type: object
      properties:
        message:
          type: string
        page:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        response:
          type: array
          items:
            $ref: "#/components/schemas/TaskDefinitionView"
    ApiPageResponseTaskTATReportByProductDto:
      type: object
      properties:
        message:
          type: string
        page:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        response:
          type: array
          items:
            $ref: "#/components/schemas/TaskTATReportByProductDto"
    ApiResponseAutoEngineConfig:
      type: object
      properties:
        message:
          type: string
        response:
          $ref: "#/components/schemas/AutoEngineConfig"
    ApiResponseBoolean:
      type: object
      properties:
        message:
          type: string
        response:
          type: boolean
    ApiResponseBranchResponse:
      type: object
      properties:
        message:
          type: string
        response:
          $ref: "#/components/schemas/BranchResponse"
    ApiResponseListAutoEngineConfig:
      type: object
      properties:
        message:
          type: string
        response:
          type: array
          items:
            $ref: "#/components/schemas/AutoEngineConfig"
    ApiResponseListGroupedItemsDto:
      type: object
      properties:
        message:
          type: string
        response:
          type: array
          items:
            $ref: "#/components/schemas/GroupedItemsDto"
    ApiResponseString:
      type: object
      properties:
        message:
          type: string
        response:
          type: string
    ApiResponseTaskConfigResponse:
      type: object
      properties:
        message:
          type: string
        response:
          $ref: "#/components/schemas/TaskConfigResponse"
    ApiResponseTaskDefinitionDetailResponse:
      type: object
      properties:
        message:
          type: string
        response:
          $ref: "#/components/schemas/TaskDefinitionDetailResponse"
    ApiResponseTaskDefinitionResponse:
      type: object
      properties:
        message:
          type: string
        response:
          $ref: "#/components/schemas/TaskDefinitionResponse"
    AppUser:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        systemUuid:
          $ref: "#/components/schemas/UUID"
        systemId:
          type: integer
          format: int64
        name:
          type: string
        email:
          type: string
        role:
          type: string
        working:
          type: boolean
        status:
          $ref: "#/components/schemas/UserStatus"
        createdAt:
          $ref: "#/components/schemas/Instant"
        updatedAt:
          $ref: "#/components/schemas/Instant"
    AssignTaskDefinitionRequest:
      type: object
      required:
      - assigneeId
      properties:
        assigneeId:
          $ref: "#/components/schemas/UUID"
    AutoEngineConfig:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        maxCapacity:
          type: integer
          format: int32
        createdAt:
          $ref: "#/components/schemas/Instant"
        updatedAt:
          $ref: "#/components/schemas/Instant"
    Branch:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        systemBranchId:
          type: integer
          format: int64
        branchUuid:
          $ref: "#/components/schemas/UUID"
        branchName:
          type: string
        tenantId:
          $ref: "#/components/schemas/UUID"
        status:
          type: string
        createdAt:
          $ref: "#/components/schemas/Instant"
        updatedAt:
          $ref: "#/components/schemas/Instant"
    BranchResponse:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        systemBranchId:
          type: integer
          format: int64
        branchUuid:
          $ref: "#/components/schemas/UUID"
        branchName:
          type: string
        tenantId:
          $ref: "#/components/schemas/UUID"
        status:
          type: string
    BranchSyncEventRequest:
      type: object
      required:
      - branch_id
      - branch_name
      - branch_uuid
      - tenant_id
      - status
      properties:
        branch_id:
          type: integer
          format: int64
        branch_name:
          type: string
        branch_uuid:
          $ref: "#/components/schemas/UUID"
        tenant_id:
          $ref: "#/components/schemas/UUID"
        status:
          type: string
    BranchUserSyncEventRequest:
      type: object
      required:
      - branch_id
      - user_id
      properties:
        branch_id:
          type: integer
          format: int64
        user_id:
          type: integer
          format: int64
    BulkAssignTaskDefinitionRequest:
      type: object
      required:
      - taskDefinitionIds
      - assigneeId
      properties:
        taskDefinitionIds:
          type: array
          minItems: 1
          items:
            type: string
            format: uuid
            pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
        assigneeId:
          $ref: "#/components/schemas/UUID"
    ConfigsAndBranches:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        branch:
          $ref: "#/components/schemas/Branch"
        createdAt:
          $ref: "#/components/schemas/Instant"
        branchId:
          $ref: "#/components/schemas/UUID"
    ConfigsAndGroups:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        group:
          $ref: "#/components/schemas/RoleGroup"
        createdAt:
          $ref: "#/components/schemas/Instant"
        roleGroupId:
          $ref: "#/components/schemas/UUID"
    CreateTaskConfigRequest:
      type: object
      required:
      - orgId
      - name
      - roleGroupIds
      properties:
        orgId:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
        type:
          type:
          - string
          - "null"
          description: Task config type. Optional on create.
          anyOf:
          - $ref: "#/components/schemas/TypeStatus"
          - type: "null"
        slaMinutes:
          type:
          - integer
          - "null"
          format: int32
          description: SLA in minutes. Optional.
        maxActiveTasks:
          type:
          - integer
          - "null"
          format: int32
          description: Maximum active tasks. Optional.
        roleGroupIds:
          type: array
          items:
            type: string
            format: uuid
            pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
        branchIds:
          type:
          - array
          - "null"
          items:
            type: string
            format: uuid
            pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
          description: Branch UUIDs to associate with this config. Optional.
    CreateTaskDefinitionRequest:
      type: object
      properties:
        name:
          type: string
        userId:
          $ref: "#/components/schemas/UUID"
        type:
          type: string
        requestId:
          $ref: "#/components/schemas/UUID"
        configId:
          $ref: "#/components/schemas/UUID"
        status:
          $ref: "#/components/schemas/TaskDefinitionStatus"
        loanAmount:
          type: integer
          format: int64
        priority:
          type: integer
          format: int32
        product:
          $ref: "#/components/schemas/ProductType"
    CreateTaskEventRequest:
      type: object
      required:
      - configId
      - requestId
      - organization
      properties:
        configId:
          $ref: "#/components/schemas/UUID"
        product:
          $ref: "#/components/schemas/ProductType"
        loanAmount:
          type: integer
          format: int64
        priority:
          type: integer
          format: int32
        checkExist:
          type: boolean
        requestId:
          $ref: "#/components/schemas/UUID"
        organization:
          $ref: "#/components/schemas/UUID"
        roleGroupSystemIds:
          type: array
          items:
            type: integer
            format: int64
    GroupedItemsDto:
      type: object
      properties:
        count:
          type: integer
          format: int64
        group:
          type: string
    Instant:
      type: string
      format: date-time
      examples:
      - 2022-03-10T16:15:50Z
    LocalDate:
      type: string
      format: date
      examples:
      - 2022-03-10
    OrgResponse:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
        systemUuid:
          $ref: "#/components/schemas/UUID"
        createdAt:
          $ref: "#/components/schemas/Instant"
    Organization:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        systemUuid:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
        systemId:
          type: integer
          format: int64
        createdAt:
          $ref: "#/components/schemas/Instant"
        updatedAt:
          $ref: "#/components/schemas/Instant"
    ProductType:
      type: string
      enum:
      - TERM
      - REVOLVING
      - INSTALLMENT
      - CASH_LOAN
      - ANY
      - ALL
    RoleGroup:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        systemUuid:
          $ref: "#/components/schemas/UUID"
        systemId:
          type: integer
          format: int64
        name:
          type: string
        createdAt:
          $ref: "#/components/schemas/Instant"
        updatedAt:
          $ref: "#/components/schemas/Instant"
    RoleGroupResponse:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
        systemUuid:
          $ref: "#/components/schemas/UUID"
        createdAt:
          $ref: "#/components/schemas/Instant"
        updatedAt:
          $ref: "#/components/schemas/Instant"
    RoleGroupSyncEventRequest:
      type: object
      required:
      - tenant_id
      - name
      - id
      properties:
        tenant_id:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
        id:
          type: integer
          format: int64
    StateMachineActionPayload:
      type: object
      required:
      - taskConfigId
      - requestId
      - organization
      properties:
        taskConfigId:
          $ref: "#/components/schemas/UUID"
        requestId:
          $ref: "#/components/schemas/UUID"
        organization:
          $ref: "#/components/schemas/UUID"
    TaskConfigResponse:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        orgId:
          $ref: "#/components/schemas/UUID"
        configsAndGroups:
          type: array
          items:
            $ref: "#/components/schemas/ConfigsAndGroups"
        configsAndBranches:
          type: array
          items:
            $ref: "#/components/schemas/ConfigsAndBranches"
        organization:
          $ref: "#/components/schemas/Organization"
        name:
          type: string
        type:
          $ref: "#/components/schemas/TypeStatus"
        slaMinutes:
          type: integer
          format: int32
        maxActiveTasks:
          type: integer
          format: int32
        createdAt:
          $ref: "#/components/schemas/Instant"
        updatedAt:
          $ref: "#/components/schemas/Instant"
        deletedAt:
          $ref: "#/components/schemas/Instant"
    TaskDefinitionDetailResponse:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
        author:
          $ref: "#/components/schemas/AppUser"
        type:
          type: string
        priority:
          type: integer
          format: int32
        status:
          $ref: "#/components/schemas/TaskDefinitionStatus"
        loanAmount:
          type: integer
          format: int64
        product:
          $ref: "#/components/schemas/ProductType"
        createdAt:
          $ref: "#/components/schemas/Instant"
        tat:
          type: integer
          format: int32
        timezone:
          type: string
        slaMinutes:
          type: integer
          format: int32
        requestId:
          $ref: "#/components/schemas/UUID"
        assignee:
          $ref: "#/components/schemas/AppUser"
        assigneeId:
          $ref: "#/components/schemas/UUID"
        taskInstances:
          type: array
          items:
            $ref: "#/components/schemas/TaskInstanceResponse"
        latestAssignee:
          $ref: "#/components/schemas/AppUser"
    TaskDefinitionResponse:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        requestId:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
        userId:
          $ref: "#/components/schemas/UUID"
        type:
          type: string
        slaMinutes:
          type: integer
          format: int32
        priority:
          type: integer
          format: int32
        maxActiveTasks:
          type: integer
          format: int32
        status:
          $ref: "#/components/schemas/TaskDefinitionStatus"
        OrgUuid:
          $ref: "#/components/schemas/UUID"
    TaskDefinitionStatus:
      type: string
      enum:
      - TO_DO
      - IN_PROGRESS
      - PAUSE
      - OVERDUE
      - COMPLETED
      - CANCELLED
    TaskDefinitionView:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
        author:
          $ref: "#/components/schemas/AppUser"
        type:
          type: string
        priority:
          type: integer
          format: int32
        status:
          $ref: "#/components/schemas/TaskDefinitionStatus"
        loanAmount:
          type: integer
          format: int64
        product:
          $ref: "#/components/schemas/ProductType"
        createdAt:
          $ref: "#/components/schemas/Instant"
        tat:
          type: integer
          format: int32
        timezone:
          type: string
        slaMinutes:
          type: integer
          format: int32
        requestId:
          $ref: "#/components/schemas/UUID"
        assignee:
          $ref: "#/components/schemas/AppUser"
        assigneeId:
          $ref: "#/components/schemas/UUID"
    TaskInstanceResponse:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        assigneeId:
          $ref: "#/components/schemas/UUID"
        status:
          $ref: "#/components/schemas/TaskInstanceStatus"
        createdAt:
          $ref: "#/components/schemas/Instant"
        completedAt:
          $ref: "#/components/schemas/Instant"
        version:
          type: integer
          format: int32
        definitionId:
          $ref: "#/components/schemas/UUID"
        groupId:
          $ref: "#/components/schemas/UUID"
    TaskInstanceStatus:
      type: string
      enum:
      - FRESH
      - CONTINUE
      - PAUSE
      - RE_OPENED
      - OVERDUE
      - COMPLETED
      - CANCELLED
    TaskTATReportByProductDto:
      type: object
      properties:
        product:
          $ref: "#/components/schemas/ProductType"
        createdAt:
          $ref: "#/components/schemas/LocalDate"
        taskType:
          type: string
        taskCount:
          type: integer
          format: int64
        totalAmount:
          type: integer
          format: int64
        status:
          $ref: "#/components/schemas/TaskDefinitionStatus"
    TenantSyncEventRequest:
      type: object
      required:
      - tenant_id
      - name
      - id
      properties:
        tenant_id:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
        id:
          type: integer
          format: int64
    TypeStatus:
      type: string
      enum:
      - SYSTEM
      - MANUAL
    UUID:
      type: string
      format: uuid
      pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
    UpdateAutoEngineConfigRequest:
      type: object
      required:
      - maxCapacity
      properties:
        maxCapacity:
          type: integer
          exclusiveMinimum: 0
          format: int32
    UpdateTaskConfigRequest:
      type: object
      properties:
        orgId:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
        type:
          $ref: "#/components/schemas/TypeStatus"
        slaMinutes:
          type: integer
          format: int32
        maxActiveTasks:
          type: integer
          format: int32
        roleGroupIds:
          type: array
          items:
            type: string
            format: uuid
            pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
        branchIds:
          type: array
          items:
            type: string
            format: uuid
            pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
    UpdateTaskDefinitionRequest:
      type: object
      required:
      - status
      properties:
        status:
          $ref: "#/components/schemas/TaskDefinitionStatus"
    UserRoleGroupEventRequest:
      type: object
      required:
      - user_id
      - role_group_id
      properties:
        user_id:
          type: integer
          format: int64
        role_group_id:
          type: integer
          format: int64
    UserStatus:
      type: string
      enum:
      - ACTIVE
      - INACTIVE
    UserSyncEventRequest:
      type: object
      required:
      - id
      - keycloak_uuid
      - first_name
      - tenant_id
      - status
      properties:
        id:
          type: integer
          format: int64
        keycloak_uuid:
          $ref: "#/components/schemas/UUID"
        first_name:
          type: string
        email:
          type: string
        tenant_id:
          $ref: "#/components/schemas/UUID"
        status:
          type: string
paths:
  /api/auth/is-offline:
    get:
      summary: Mark user offline
      description: Marks user as offline using x-api-gw-user-uuid header value.
      tags:
      - User Working
      parameters:
      - description: User UUID header
        name: x-api-gw-user-uuid
        required: true
        in: header
        schema:
          type: string
      responses:
        "200":
          description: User marked offline successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseString"
        "400":
          description: Invalid or missing user UUID header
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      x-zudoku-badges:
      - label: Branch headers
        color: indigo
      - label: Admin
        color: gray
      x-attach-branch-headers: true
  /api/auth/is-online:
    get:
      summary: Mark user online
      description: Marks user as online using x-api-gw-user-uuid header value.
      tags:
      - User Working
      parameters:
      - description: User UUID header
        name: x-api-gw-user-uuid
        required: true
        in: header
        schema:
          type: string
      responses:
        "200":
          description: User marked online successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseString"
        "400":
          description: Invalid or missing user UUID header
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      x-zudoku-badges:
      - label: Branch headers
        color: indigo
      - label: Admin
        color: gray
      x-attach-branch-headers: true
  /api/auth/status:
    get:
      summary: Get user online status
      description: Returns whether the user is currently online (working=true) or
        offline (working=false).
      tags:
      - User Working
      parameters:
      - description: User UUID header
        name: x-api-gw-user-uuid
        required: true
        in: header
        schema:
          type: string
      responses:
        "200":
          description: User online status returned successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseBoolean"
        "400":
          description: Invalid or missing user UUID header
        "404":
          description: User not found
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      x-zudoku-badges:
      - label: Branch headers
        color: indigo
      - label: Admin
        color: gray
      x-attach-branch-headers: true
  /api/config:
    get:
      summary: List task configurations
      description: Returns paginated task configurations using filter criteria.
      tags:
      - Task Configuration
      parameters:
      - description: Page size
        name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
      - description: Maximum max active task value
        name: maxActiveTaskMax
        in: query
        schema:
          type: integer
          format: int32
      - description: Minimum max active task value
        name: maxActiveTaskMin
        in: query
        schema:
          type: integer
          format: int32
      - description: Configuration name filter
        name: name
        in: query
        schema:
          type: string
      - description: Organization UUIDs filter
        name: organizationId
        in: query
        schema:
          type: array
          items:
            type: string
            format: uuid
            pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
      - description: Page number (1-based)
        name: page
        in: query
        schema:
          type: integer
          format: int32
          default: 1
      - description: Role UUIDs filter
        name: roleIds
        in: query
        schema:
          type: array
          items:
            type: string
            format: uuid
            pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
      - description: Maximum SLA in minutes
        name: slaMax
        in: query
        schema:
          type: integer
          format: int32
      - description: Minimum SLA in minutes
        name: slaMin
        in: query
        schema:
          type: integer
          format: int32
      - description: Configuration type/status filter
        name: type
        in: query
        schema:
          $ref: "#/components/schemas/TypeStatus"
      responses:
        "200":
          description: Task configuration list retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseTaskConfigResponse"
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/config/auto-config/list:
    get:
      summary: List auto-engine configurations
      description: Returns all auto-assignment engine configurations.
      tags:
      - Task Configuration
      responses:
        "200":
          description: Auto-engine configurations retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseListAutoEngineConfig"
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/config/auto-config/update/{id}:
    patch:
      summary: Update auto-engine configuration
      description: Updates auto-assignment engine configuration by ID.
      tags:
      - Task Configuration
      parameters:
      - description: Auto-engine configuration UUID
        name: id
        required: true
        in: path
        schema:
          $ref: "#/components/schemas/UUID"
      requestBody:
        description: Auto-engine configuration update payload
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateAutoEngineConfigRequest"
        required: true
      responses:
        "200":
          description: Auto-engine configuration updated successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseAutoEngineConfig"
        "400":
          description: Invalid request payload
        "404":
          description: Auto-engine configuration not found
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/config/create:
    post:
      summary: Create task configuration
      description: Creates a new task configuration.
      tags:
      - Task Configuration
      requestBody:
        description: "Task configuration creation payload. Optional fields: type,\
          \ slaMinutes, maxActiveTasks"
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTaskConfigRequest"
        required: true
      responses:
        "200":
          description: Task configuration created successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskConfigResponse"
        "400":
          description: Invalid request payload
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/config/update/{id}:
    patch:
      summary: Update task configuration
      description: Updates an existing task configuration by ID.
      tags:
      - Task Configuration
      parameters:
      - description: Task configuration UUID
        name: id
        required: true
        in: path
        schema:
          $ref: "#/components/schemas/UUID"
      requestBody:
        description: Task configuration update payload
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTaskConfigRequest"
        required: true
      responses:
        "200":
          description: Task configuration updated successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskConfigResponse"
        "400":
          description: Invalid request payload
        "404":
          description: Task configuration not found
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/config/{id}:
    get:
      summary: Get task configuration
      description: Retrieves detailed configuration for a specific task configuration
        ID.
      tags:
      - Task Configuration
      parameters:
      - description: Task configuration UUID
        name: id
        required: true
        in: path
        schema:
          $ref: "#/components/schemas/UUID"
      responses:
        "200":
          description: Task configuration retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskConfigResponse"
        "404":
          description: Task configuration not found
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
    delete:
      summary: Delete task configuration
      description: Deletes task configuration by ID.
      tags:
      - Task Configuration
      parameters:
      - description: Task configuration UUID
        name: id
        required: true
        in: path
        schema:
          $ref: "#/components/schemas/UUID"
      responses:
        "200":
          description: Task configuration deleted successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseString"
        "404":
          description: Task configuration not found
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/reference/branch-list:
    get:
      summary: List branches
      description: "Returns paginated branches, optionally filtered by name and active\
        \ status."
      tags:
      - Reference Data
      parameters:
      - description: Page number (1-based)
        in: query
        name: page
        schema:
          type: integer
          format: int32
          default: 1
      - description: Page size
        in: query
        name: limit
        schema:
          type: integer
          format: int32
          default: 20
      - description: Branch name filter (partial match)
        in: query
        name: name
        schema:
          type: string
      - description: "When true, returns only ACTIVE branches"
        in: query
        name: activeOnly
        schema:
          type: boolean
      responses:
        "200":
          description: Branch list retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseBranchResponse"
        "400":
          description: Invalid query parameters
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/reference/branch/{uuid}:
    get:
      summary: Get branch by UUID
      description: Returns a single branch by its branch UUID.
      tags:
      - Reference Data
      parameters:
      - description: Branch UUID
        name: uuid
        required: true
        in: path
        schema:
          $ref: "#/components/schemas/UUID"
      responses:
        "200":
          description: Branch retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseBranchResponse"
        "404":
          description: Branch not found
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/reference/org-list:
    get:
      summary: List organizations
      description: Returns paginated organization reference data.
      tags:
      - Reference Data
      parameters:
      - description: Page number (1-based)
        in: query
        name: page
        schema:
          type: integer
          format: int32
          default: "1"
      - description: Page size
        in: query
        name: limit
        schema:
          type: integer
          format: int32
          default: "50"
      - description: Sort field
        in: query
        name: sort
        schema:
          type: array
          items:
            type: string
      responses:
        "200":
          description: Organization list retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseOrgResponse"
        "400":
          description: Invalid query parameters
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal server error
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/reference/role-group-list:
    get:
      summary: List role groups
      description: Returns paginated role group reference data.
      tags:
      - Reference Data
      parameters:
      - description: Page number (1-based)
        in: query
        name: page
        schema:
          type: integer
          format: int32
          default: "1"
      - description: Page size
        in: query
        name: limit
        schema:
          type: integer
          format: int32
          default: "50"
      - description: Sort field
        in: query
        name: sort
        schema:
          type: array
          items:
            type: string
      responses:
        "200":
          description: Role group list retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseRoleGroupResponse"
        "400":
          description: Invalid query parameters
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal server error
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/reference/sync_redis:
    get:
      summary: Synchronize Redis cache
      description: Triggers full reference data synchronization into Redis.
      tags:
      - Reference Data
      responses:
        "200":
          description: Redis synchronization completed successfully
          content:
            application/json:
              schema: {}
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal server error
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/reference/users:
    get:
      summary: List users
      description: Returns paginated users filtered by name and optional task configuration
        scope.
      tags:
      - Reference Data
      parameters:
      - description: Page size
        name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
      - description: User name filter
        name: name
        in: query
        schema:
          type: string
      - description: Page number (1-based)
        name: page
        in: query
        schema:
          type: integer
          format: int32
          default: 1
      - description: Task configuration UUID filters for organization scoping
        name: taskConfigIds
        in: query
        schema:
          type: array
          items:
            type: string
            format: uuid
            pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
      responses:
        "200":
          description: User list retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseAppUser"
        "400":
          description: Invalid query parameters
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal server error
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/report:
    get:
      summary: List task report data
      description: Returns paginated task report records with filtering and sorting.
      tags:
      - Task Report
      parameters:
      - description: Maximum amount filter
        name: amountMax
        in: query
        schema:
          type: integer
          format: int32
      - description: Minimum amount filter
        name: amountMin
        in: query
        schema:
          type: integer
          format: int32
      - description: Assignee UUID filters
        name: assigneeId
        in: query
        schema:
          type: array
          items:
            type: string
            format: uuid
            pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
      - description: Created end date filter (yyyy-MM-dd)
        name: createdAtEnd
        in: query
        schema:
          type: string
      - description: Created start date filter (yyyy-MM-dd)
        name: createdAtStart
        in: query
        schema:
          type: string
      - description: Page size
        name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
          minimum: 1
      - description: Task name filter
        name: name
        in: query
        schema:
          type: string
      - description: Page number (1-based)
        name: page
        in: query
        schema:
          type: integer
          format: int32
          default: 1
          minimum: 1
      - description: Maximum process time filter
        name: processTimeMax
        in: query
        schema:
          type: integer
          format: int32
      - description: Minimum process time filter
        name: processTimeMin
        in: query
        schema:
          type: integer
          format: int32
      - description: Product filters
        name: product
        in: query
        schema:
          type: array
          items:
            $ref: "#/components/schemas/ProductType"
      - description: Maximum SLA in minutes
        name: slaMax
        in: query
        schema:
          type: integer
          format: int32
      - description: Minimum SLA in minutes
        name: slaMin
        in: query
        schema:
          type: integer
          format: int32
      - description: Sort column
        name: sortColumn
        in: query
        schema:
          type: string
          default: createdAt
      - description: "Sort direction: asc or desc"
        name: sortDirection
        in: query
        schema:
          type: string
          default: desc
      - description: Task status filters
        name: status
        in: query
        schema:
          type: array
          items:
            $ref: "#/components/schemas/TaskDefinitionStatus"
      - description: Task type filters
        name: type
        in: query
        schema:
          type: array
          items:
            $ref: "#/components/schemas/TypeStatus"
      responses:
        "200":
          description: Task report data retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseTaskDefinitionView"
        "400":
          description: Invalid query parameters
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal server error
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/report/tat-by-product:
    get:
      summary: List TAT by product report
      description: Returns paginated TAT analytics grouped by product with optional
        filters.
      tags:
      - Task Report
      parameters:
      - description: Created end date filter (yyyy-MM-dd)
        name: createdAtEnd
        in: query
        schema:
          type: string
      - description: Created start date filter (yyyy-MM-dd)
        name: createdAtStart
        in: query
        schema:
          type: string
      - description: Page size
        name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
          minimum: 1
      - description: Page number (1-based)
        name: page
        in: query
        schema:
          type: integer
          format: int32
          default: 1
          minimum: 1
      - description: Sort column
        name: sortColumn
        in: query
        schema:
          type: string
          default: createdAt
      - description: "Sort direction: asc or desc"
        name: sortDirection
        in: query
        schema:
          type: string
          default: desc
      - description: Task status filters
        name: status
        in: query
        schema:
          type: array
          items:
            $ref: "#/components/schemas/TaskDefinitionStatus"
      responses:
        "200":
          description: TAT by product report retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseTaskTATReportByProductDto"
        "400":
          description: Invalid query parameters
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal server error
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/state-machine/close:
    delete:
      summary: Cancel tasks by request ID
      description: Cancels all active tasks for a specific request ID.
      tags:
      - State Machine
      requestBody:
        description: Payload containing request ID
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StateMachineActionPayload"
      responses:
        "200":
          description: Tasks cancelled successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseTaskDefinitionResponse"
        "400":
          description: Invalid request payload
        "404":
          description: Request or task definitions not found
  /api/state-machine/complete:
    patch:
      summary: Complete task
      description: Marks an active task as COMPLETED.
      tags:
      - State Machine
      requestBody:
        description: Task transition payload containing task definition ID
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StateMachineActionPayload"
      responses:
        "200":
          description: Task completed successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskDefinitionResponse"
        "400":
          description: Invalid request payload
        "404":
          description: Task definition not found or transition not allowed
  /api/state-machine/configs:
    get:
      summary: List task configurations
      description: Returns paginated task configurations used by the state machine.
      tags:
      - State Machine
      parameters:
      - description: Page size
        name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
      - description: Page number (1-based)
        name: page
        in: query
        schema:
          type: integer
          format: int32
          default: 1
      responses:
        "200":
          description: Task configurations retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseTaskConfigResponse"
  /api/state-machine/continue:
    patch:
      summary: Continue task
      description: Continues a paused task and sets status to IN_PROGRESS.
      tags:
      - State Machine
      requestBody:
        description: Task transition payload containing task definition ID
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StateMachineActionPayload"
      responses:
        "200":
          description: Task continued successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskDefinitionResponse"
        "400":
          description: Invalid request payload
        "404":
          description: Task definition not found or transition not allowed
  /api/state-machine/pause:
    patch:
      summary: Pause task
      description: Pauses an active task.
      tags:
      - State Machine
      requestBody:
        description: "Task transition payload containing taskConfigId, requestId and\
          \ organizationId"
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StateMachineActionPayload"
      responses:
        "200":
          description: Task paused successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskDefinitionResponse"
        "400":
          description: Invalid request payload
        "404":
          description: Task definition not found or transition not allowed
  /api/state-machine/reopen:
    patch:
      summary: Reopen task
      description: Reopens a completed task and sets status back to IN_PROGRESS.
      tags:
      - State Machine
      requestBody:
        description: "Task transition payload containing taskConfigId, requestId and\
          \ organizationId"
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StateMachineActionPayload"
      responses:
        "200":
          description: Task reopened successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskDefinitionResponse"
        "400":
          description: Invalid request payload
        "404":
          description: Task definition not found or transition not allowed
  /api/state-machine/task-creation:
    post:
      summary: Create task from event
      description: Creates task definition and initial instance from incoming task
        event payload.
      tags:
      - State Machine
      parameters:
      - name: x-api-gw-user-uuid
        in: header
        schema:
          type: string
      requestBody:
        description: Task creation event payload
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTaskEventRequest"
      responses:
        "201":
          description: Task created successfully
        "400":
          description: Invalid request payload
        "500":
          description: Task creation failed
  /api/task-definitions:
    get:
      summary: List task definitions
      description: |-
        Returns paginated task definitions with filtering and sorting.

        ### Permissions required
        - `task:TASK_MENU_VIEW_BY_ORG`
        - `task:TASK_MENU_VIEW_BY_ASSIGNEE`
      tags:
      - Task Definition
      parameters:
      - description: Maximum amount filter
        name: amountMax
        in: query
        schema:
          type: integer
          format: int32
      - description: Minimum amount filter
        name: amountMin
        in: query
        schema:
          type: integer
          format: int32
      - description: Assignee UUID filters
        name: assigneeId
        in: query
        schema:
          type: array
          items:
            type: string
            format: uuid
            pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
      - description: Created end datetime filter
        name: createdAtEnd
        in: query
        schema:
          type: string
      - description: Created start datetime filter
        name: createdAtStart
        in: query
        schema:
          type: string
      - description: Only tasks assigned to current user
        name: isMine
        in: query
        schema:
          type: boolean
          default: "false"
      - description: Page size
        name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
          minimum: 1
      - description: Task name filter
        name: name
        in: query
        schema:
          type: string
      - description: Page number (1-based)
        name: page
        in: query
        schema:
          type: integer
          format: int32
          default: 1
          minimum: 1
      - description: Maximum process time filter
        name: processTimeMax
        in: query
        schema:
          type: integer
          format: int32
      - description: Minimum process time filter
        name: processTimeMin
        in: query
        schema:
          type: integer
          format: int32
      - description: Product filters
        name: product
        in: query
        schema:
          type: array
          items:
            $ref: "#/components/schemas/ProductType"
      - description: Task requestId filter
        name: requestId
        in: query
        schema:
          $ref: "#/components/schemas/UUID"
      - description: Maximum SLA in minutes
        name: slaMax
        in: query
        schema:
          type: integer
          format: int32
      - description: Minimum SLA in minutes
        name: slaMin
        in: query
        schema:
          type: integer
          format: int32
      - description: Sort column
        name: sortColumn
        in: query
        schema:
          type: string
          default: createdAt
      - description: "Sort direction: asc or desc"
        name: sortDirection
        in: query
        schema:
          type: string
          default: desc
      - description: Task status filters
        name: status
        in: query
        schema:
          type: array
          items:
            $ref: "#/components/schemas/TaskDefinitionStatus"
      - description: Task type filters
        name: type
        in: query
        schema:
          type: array
          items:
            $ref: "#/components/schemas/TypeStatus"
      responses:
        "200":
          description: Task definitions retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseTaskDefinitionView"
        "400":
          description: Invalid query parameters
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Protected
        color: blue
      - label: Branch headers
        color: indigo
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
      x-required-permissions:
      - task:TASK_MENU_VIEW_BY_ORG
      - task:TASK_MENU_VIEW_BY_ASSIGNEE
      x-attach-branch-headers: true
    post:
      summary: Create task definition
      description: Creates a new manual task definition.
      tags:
      - Task Definition
      requestBody:
        description: Task definition creation payload
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTaskDefinitionRequest"
      responses:
        "201":
          description: Task definition created successfully
        "400":
          description: Invalid request payload
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/task-definitions/assign/bulk:
    patch:
      summary: Bulk assign task definitions
      description: Assigns multiple task definitions to a single assignee.
      tags:
      - Task Definition
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BulkAssignTaskDefinitionRequest"
        required: true
      responses:
        "200":
          description: Task definitions assigned successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiPageResponseTaskDefinitionResponse"
        "400":
          description: Invalid request payload
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/task-definitions/stats:
    get:
      summary: Get task definition statistics
      description: Returns grouped task statistics for the selected time range.
      tags:
      - Task Definition
      parameters:
      - name: createdAtEnd
        in: query
        schema:
          type: string
      - name: createdAtStart
        in: query
        schema:
          type: string
      - name: isMine
        in: query
        schema:
          type: boolean
          default: "false"
      responses:
        "200":
          description: Task statistics retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseListGroupedItemsDto"
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/task-definitions/update/{id}:
    patch:
      summary: Update task definition (alias)
      description: Alias endpoint for updating manual task definition by ID.
      tags:
      - Task Definition
      parameters:
      - name: id
        in: path
        required: true
        schema:
          $ref: "#/components/schemas/UUID"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTaskDefinitionRequest"
        required: true
      responses:
        "200":
          description: Task definition updated successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskDefinitionResponse"
        "400":
          description: Invalid request payload
        "404":
          description: Task definition not found
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/task-definitions/{id}:
    patch:
      summary: Update task definition
      description: Updates manual task definition status by ID.
      tags:
      - Task Definition
      parameters:
      - description: Task definition UUID
        name: id
        required: true
        in: path
        schema:
          $ref: "#/components/schemas/UUID"
      requestBody:
        description: Task definition update payload
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTaskDefinitionRequest"
      responses:
        "200":
          description: Task definition updated successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskDefinitionResponse"
        "400":
          description: Invalid request payload
        "404":
          description: Task definition not found
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
    get:
      summary: Get task definition by ID
      description: Returns detailed task definition by ID.
      tags:
      - Task Definition
      parameters:
      - description: Task definition UUID
        name: id
        required: true
        in: path
        schema:
          $ref: "#/components/schemas/UUID"
      responses:
        "200":
          description: Task definition retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskDefinitionDetailResponse"
        "403":
          description: Forbidden to view this task definition
        "404":
          description: Task definition not found
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
  /api/task-definitions/{id}/assign:
    patch:
      summary: Assign task definition
      description: |-
        Assigns a manual task definition to a specific assignee.

        ### Permissions required
        - `task:TASK_MENU_ASSIGN_ACTION`
      tags:
      - Task Definition
      parameters:
      - name: id
        in: path
        required: true
        schema:
          $ref: "#/components/schemas/UUID"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssignTaskDefinitionRequest"
        required: true
      responses:
        "200":
          description: Task definition assigned successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseTaskDefinitionResponse"
        "400":
          description: Invalid request payload
        "404":
          description: Task definition or assignee not found
      security:
      - OrgId: []
      - UserId: []
      x-expose-to-gateways:
      - admin-apigw
      - openapi-apigw
      x-zudoku-badges:
      - label: Protected
        color: blue
      - label: Admin
        color: gray
      - label: OpenAPI
        color: gray
      x-required-permissions:
      - task:TASK_MENU_ASSIGN_ACTION
  /internal/events/branch_users:
    post:
      summary: Sync user branch event
      description: Consumes user-branch synchronization event payload and updates
        internal reference data.
      tags:
      - Auth Data Sync
      requestBody:
        description: User branch sync event payload
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BranchUserSyncEventRequest"
        required: true
      responses:
        "200":
          description: User branch sync event processed successfully
          content:
            application/json:
              schema:
                type: string
        "400":
          description: Invalid user branch sync payload
        "404":
          description: User or branch not found
        "500":
          description: User branch sync event processing failed
          content:
            application/json:
              schema:
                type: string
      security:
      - OrgId: []
      - UserId: []
  /internal/events/branches:
    post:
      summary: Sync branch event
      description: Consumes branch synchronization event payload and updates internal
        reference data.
      tags:
      - Auth Data Sync
      requestBody:
        description: Branch sync event payload
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BranchSyncEventRequest"
        required: true
      responses:
        "200":
          description: Branch sync event processed successfully
          content:
            application/json:
              schema:
                type: string
        "400":
          description: Invalid branch sync payload
        "500":
          description: Branch sync event processing failed
          content:
            application/json:
              schema:
                type: string
      security:
      - OrgId: []
      - UserId: []
  /internal/events/inactive/user/{id}:
    patch:
      summary: Deactivate user by system ID
      description: "Sets user INACTIVE, forces offline, revokes and requeues all active\
        \ tasks"
      tags:
      - Auth Data Sync
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
          format: int64
      responses:
        "200":
          description: User deactivated successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseString"
        "404":
          description: User not found
        "500":
          description: Deactivation failed
      security:
      - OrgId: []
      - UserId: []
  /internal/events/role_groups:
    post:
      summary: Sync role group event
      description: Consumes role group synchronization event payload and updates internal
        reference data.
      tags:
      - Auth Data Sync
      requestBody:
        description: Role group sync event payload
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RoleGroupSyncEventRequest"
        required: true
      responses:
        "200":
          description: Role group sync event processed successfully
          content:
            application/json:
              schema:
                type: string
        "400":
          description: Invalid role group sync payload
        "500":
          description: Role group sync event processing failed
          content:
            application/json:
              schema:
                type: string
      security:
      - OrgId: []
      - UserId: []
  /internal/events/tenants:
    post:
      summary: Sync tenant event
      description: Consumes tenant synchronization event payload and updates internal
        reference data.
      tags:
      - Auth Data Sync
      requestBody:
        description: Tenant sync event payload
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TenantSyncEventRequest"
        required: true
      responses:
        "200":
          description: Tenant sync event processed successfully
          content:
            application/json:
              schema:
                type: string
        "400":
          description: Invalid tenant sync payload
        "500":
          description: Tenant sync event processing failed
          content:
            application/json:
              schema:
                type: string
      security:
      - OrgId: []
      - UserId: []
  /internal/events/user_role_groups:
    post:
      summary: Sync user role group event
      description: Consumes user-role-group synchronization event payload and updates
        internal reference data.
      tags:
      - Auth Data Sync
      requestBody:
        description: User role group sync event payload
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UserRoleGroupEventRequest"
        required: true
      responses:
        "200":
          description: User role group sync event processed successfully
          content:
            application/json:
              schema:
                type: string
        "400":
          description: Invalid user role group sync payload
        "404":
          description: User or role group not found
        "500":
          description: User role group sync event processing failed
          content:
            application/json:
              schema:
                type: string
      security:
      - OrgId: []
      - UserId: []
  /internal/events/users:
    post:
      summary: Sync user event
      description: Consumes user synchronization event payload and updates internal
        reference data.
      tags:
      - Auth Data Sync
      requestBody:
        description: User sync event payload
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UserSyncEventRequest"
        required: true
      responses:
        "200":
          description: User sync event processed successfully
          content:
            application/json:
              schema:
                type: string
        "400":
          description: Invalid user sync payload
        "500":
          description: User sync event processing failed
          content:
            application/json:
              schema:
                type: string
      security:
      - OrgId: []
      - UserId: []
info:
  title: task-management-service API
  version: 1.0.0-SNAPSHOT
  description: |-
    # Task Management

    Turns **workflow steps into actionable work items** and routes them to the right people.

    ## Overview
    Creates tasks from workflow events, prioritizes them, and assigns them automatically — with manual and bulk assignment available — while tracking status changes, monitoring deadlines, and supporting reporting on the work.

    ## Why it exists
    Work generated by the lending process needs to reach the right person and be completed on time. This service makes that distribution consistent and visible, so nothing is dropped and teams can see what is outstanding and how it is progressing.

    ## Authentication
    Requests are authenticated by the platform gateway, which identifies the caller and their organization. Access is further restricted per endpoint by the caller's permissions.
