{
  "openapi": "3.0.3",
  "info": {
    "title": "NextX Open Platform API",
    "version": "2026-10-28.5",
    "description": "API công khai cho đối tác — sinh tự động từ mã nguồn các phân hệ. Xác thực: OAuth 2.0 (Bearer) hoặc khoá API. https://developers.nextx.vn"
  },
  "servers": [
    {
      "url": "https://api.nextx.vn",
      "description": "Production"
    },
    {
      "url": "https://api-dev.nextx.vn",
      "description": "Sandbox"
    }
  ],
  "security": [
    {
      "apiKeyAuth": []
    },
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "office"
    },
    {
      "name": "call"
    },
    {
      "name": "dms"
    },
    {
      "name": "einvoice"
    },
    {
      "name": "hrm"
    },
    {
      "name": "marketing"
    },
    {
      "name": "payment"
    },
    {
      "name": "sales"
    },
    {
      "name": "crm"
    },
    {
      "name": "comm"
    }
  ],
  "paths": {
    "/api/v1/office/approvals/instances": {
      "post": {
        "tags": [
          "office"
        ],
        "summary": "Nộp đơn (tạo instance)",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInstanceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "x-scope": "office.approval.instance.manage",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_create_approval_instance",
        "operationId": "approvals_instances_create"
      },
      "get": {
        "tags": [
          "office"
        ],
        "summary": "Hộp đơn (role=mine | todo | acted)",
        "description": "mine = đơn tôi nộp · todo = đơn đang chờ tôi duyệt · acted = đơn tôi ĐÃ quyết (duyệt/từ chối/chuyển đi), mới trước cũ sau theo thời điểm quyết. Giá trị khác ba giá trị trên trả 400 — không đoán hộ người gọi. Mỗi dòng kèm sẵn definitionName (tên quy trình) và myPendingTaskId (việc đang chờ của người gọi, rỗng nếu không có), nên giao diện không phải gọi chi tiết từng phiếu để dựng nút Duyệt/Từ chối.",
        "parameters": [
          {
            "name": "role",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "mine"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfApprovalInstanceDto"
                }
              }
            }
          }
        },
        "x-scope": "office.approval.instance.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_list_approval_instances",
        "operationId": "approvals_instances_list"
      }
    },
    "/api/v1/office/approvals/instances/{id}": {
      "get": {
        "tags": [
          "office"
        ],
        "summary": "Chi tiết instance (tasks + timeline)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalInstanceDetailDto"
                }
              }
            }
          }
        },
        "x-scope": "office.approval.instance.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_get_approval_instance",
        "operationId": "approvals_instances_get"
      }
    },
    "/api/v1/office/approvals/tasks/{taskId}/approve": {
      "post": {
        "tags": [
          "office"
        ],
        "summary": "Duyệt task",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommentRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "x-scope": "office.approval.instance.manage",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_approve_task",
        "operationId": "approvals_tasks_approve"
      }
    },
    "/api/v1/office/approvals/tasks/{taskId}/reject": {
      "post": {
        "tags": [
          "office"
        ],
        "summary": "Từ chối task",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommentRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "x-scope": "office.approval.instance.manage",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_reject_task",
        "operationId": "approvals_tasks_reject"
      }
    },
    "/api/v1/office/tables/{tableId}/records": {
      "post": {
        "tags": [
          "office"
        ],
        "summary": "Tạo record mới",
        "parameters": [
          {
            "name": "tableId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRecordRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "office.base.record.manage",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_create_record",
        "operationId": "tables_records_create"
      }
    },
    "/api/v1/office/tables/{tableId}/records/batch": {
      "put": {
        "tags": [
          "office"
        ],
        "summary": "Cập nhật nhiều record (tối đa 1000, all-or-nothing)",
        "parameters": [
          {
            "name": "tableId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchUpdateRecordsRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "office.base.record.manage",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_update_record",
        "operationId": "tables_records_batch_update"
      },
      "delete": {
        "tags": [
          "office"
        ],
        "summary": "Xoá mềm nhiều record (tối đa 1000, all-or-nothing)",
        "parameters": [
          {
            "name": "tableId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDeleteRecordsRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "office.base.record.manage",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_delete_record",
        "operationId": "tables_records_batch_delete"
      }
    },
    "/api/v1/office/tables/{tableId}/records/{recordId}": {
      "get": {
        "tags": [
          "office"
        ],
        "summary": "Lấy chi tiết record",
        "parameters": [
          {
            "name": "tableId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "office.base.record.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_get_record",
        "operationId": "tables_records_get"
      },
      "put": {
        "tags": [
          "office"
        ],
        "summary": "Cập nhật record (merge mặc định; replace=true để ghi đè)",
        "description": "Gửi kèm `expectedValues` — bản đồ field_id → giá trị mà giao diện ĐANG HIỆN của đúng những ô đang sửa — để bật khoá lạc quan. Ô nào đã bị người khác đổi thì lời gọi trả **409** kèm danh sách ô xung đột và giá trị hiện tại của chúng, và **không ô nào được ghi**. Bỏ trống `expectedValues` thì không kiểm, đúng như nếp cũ — nên client đang chạy không đổi hành vi.",
        "parameters": [
          {
            "name": "tableId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRecordRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordUpdateResult"
                }
              }
            }
          }
        },
        "x-scope": "office.base.record.manage",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_update_record",
        "operationId": "tables_records_update"
      },
      "delete": {
        "tags": [
          "office"
        ],
        "summary": "Xoá mềm record",
        "parameters": [
          {
            "name": "tableId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "office.base.record.manage",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_delete_record",
        "operationId": "tables_records_delete"
      }
    },
    "/api/v1/office/tables/{tableId}/records/list": {
      "post": {
        "tags": [
          "office"
        ],
        "summary": "Liệt kê record (phân trang + filter có cấu trúc trong body)",
        "parameters": [
          {
            "name": "tableId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListRecordsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfRecordDto"
                }
              }
            }
          }
        },
        "x-scope": "office.base.record.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "office_list_records",
        "operationId": "tables_records_list"
      }
    },
    "/api/v1/call/agents": {
      "get": {
        "tags": [
          "call"
        ],
        "summary": "Danh sách agents",
        "description": "Danh sách có phân trang, kèm trạng thái trực tuyến hiện tại của từng agent. sip_password không trả về.",
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "available",
                "on_call",
                "paused",
                "acw",
                "offline"
              ],
              "type": "string"
            }
          },
          {
            "name": "queueId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "isActive",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentListResult"
                }
              }
            }
          }
        },
        "x-scope": "call.agents.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "call_list_agents",
        "operationId": "agents_list"
      }
    },
    "/api/v1/call/call-flows": {
      "get": {
        "tags": [
          "call"
        ],
        "summary": "Danh sách call flows",
        "description": "PagedResult với triggerType filter.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "triggerType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallFlowListResult"
                }
              }
            }
          }
        },
        "x-scope": "call.call_flows.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "call_list_call_flows",
        "operationId": "call_flows_list"
      }
    },
    "/api/v1/call/calls": {
      "get": {
        "tags": [
          "call"
        ],
        "summary": "Lịch sử cuộc gọi",
        "description": "PagedResult với filters. Agent role: chỉ thấy calls có agent_id = userId.",
        "parameters": [
          {
            "name": "direction",
            "in": "query",
            "schema": {
              "enum": [
                "inbound",
                "outbound"
              ],
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "ringing",
                "answered",
                "completed",
                "missed",
                "abandoned",
                "voicemail",
                "failed"
              ],
              "type": "string"
            }
          },
          {
            "name": "agentId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "queueId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "desc"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "crmContactId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "agentInboxId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "callType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "disposition",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hourFrom",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "hourTo",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "result",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "culprit",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hasRecording",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "durationMin",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "durationMax",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "f",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallListResult"
                }
              }
            }
          }
        },
        "x-scope": "call.calls.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "call_list_calls",
        "operationId": "calls_list"
      }
    },
    "/api/v1/call/campaigns": {
      "get": {
        "tags": [
          "call"
        ],
        "summary": "Danh sách campaigns",
        "description": "PagedResult với filters: status, type, search. Bao gồm progress stats.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "draft",
                "active",
                "paused",
                "completed",
                "cancelled"
              ],
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "enum": [
                "outbound",
                "inbound"
              ],
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignListResult"
                }
              }
            }
          }
        },
        "x-scope": "call.campaigns.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "call_list_campaigns",
        "operationId": "campaigns_list"
      }
    },
    "/api/v1/call/ivr-flows": {
      "get": {
        "tags": [
          "call"
        ],
        "summary": "Danh sách IVR flows",
        "description": "PagedResult với nodeCount và isLinkedToDid.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IvrFlowListResult"
                }
              }
            }
          }
        },
        "x-scope": "call.ivr_flows.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "call_list_ivr_flows",
        "operationId": "ivr_flows_list"
      }
    },
    "/api/v1/call/phone-numbers": {
      "get": {
        "tags": [
          "call"
        ],
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "sipTrunkId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "trunkId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "schema": {
              "enum": [
                "inbound",
                "outbound",
                "both"
              ],
              "type": "string"
            }
          },
          {
            "name": "isActive",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneNumberListResult"
                }
              }
            }
          }
        },
        "x-scope": "call.phone_numbers.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "call_list_phone_numbers",
        "operationId": "phone_numbers_list"
      }
    },
    "/api/v1/call/queues": {
      "get": {
        "tags": [
          "call"
        ],
        "summary": "Danh sách queues",
        "description": "Danh sách có phân trang, kèm agentCount và activeCallers (số người đang gọi, làm mới mỗi 5 giây).",
        "parameters": [
          {
            "name": "isActive",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueListResult"
                }
              }
            }
          }
        },
        "x-scope": "call.queues.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "call_list_queues",
        "operationId": "queues_list"
      }
    },
    "/api/v1/dms/catalog/products": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Danh sách sản phẩm",
        "description": "Proxy sang Sales service. Trả về danh sách sản phẩm phân trang.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogProductPagedDto"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable"
          }
        },
        "x-scope": "dms.catalog.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_list_catalog_products",
        "operationId": "catalog_products_list"
      }
    },
    "/api/v1/dms/tracking/check-ins": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Danh sach check-in",
        "description": "Lay danh sach check-in. Date range toi da 30 ngay. Loc theo isValid (true=hop le, false=bi flag geo-fence). Manager/Supervisor xem tat ca, NV xem ban than.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "employeeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "isValid",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckinLogDtoPagedResult"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "dms.checkins.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_list_checkins",
        "operationId": "tracking_check_ins_list"
      }
    },
    "/api/v1/dms/daily-plans": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Danh sách kế hoạch ngày",
        "description": "Lấy danh sách kế hoạch ngày. Manager/Supervisor xem được tất cả, NV chỉ xem được bản thân.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "employeeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "planDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "zoneId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DailyPlanDtoPagedResult"
                }
              }
            }
          }
        },
        "x-scope": "dms.daily_plans.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_list_daily_plans",
        "operationId": "daily_plans_list"
      }
    },
    "/api/v1/dms/daily-plans/unassigned-employees": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Nhân viên chưa có kế hoạch ngày",
        "description": "Lấy danh sách nhân viên field (SalesRep, DeliveryStaff, Merchandiser) chưa có kế hoạch ngày cho ngày chỉ định.",
        "parameters": [
          {
            "name": "planDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UnassignedEmployeeDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "dms.daily_plans.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_get_daily_plan",
        "operationId": "daily_plans_unassigned_employees_list"
      }
    },
    "/api/v1/dms/daily-plans/{id}": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Chi tiết kế hoạch ngày",
        "description": "Lấy thông tin chi tiết kế hoạch ngày bao gồm danh sách tuyến.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DailyPlanDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "dms.daily_plans.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_get_daily_plan",
        "operationId": "daily_plans_get"
      }
    },
    "/api/v1/dms/daily-plans/today": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Kế hoạch ngày hôm nay",
        "description": "Lấy kế hoạch ngày hôm nay của nhân viên đang đăng nhập.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DmsMyDayPlanDto"
                }
              }
            }
          },
          "204": {
            "description": "No Content"
          }
        },
        "x-scope": "dms.daily_plans.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_get_daily_plan",
        "operationId": "daily_plans_today_get"
      }
    },
    "/api/v1/dms/daily-plans/my-visits": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Lịch đi tuyến của nhân viên đang đăng nhập, trải theo ngày",
        "description": "Quá khứ đọc check-in thật; tương lai TÍNH ẢO từ ma trận lịch chăm sóc (visit_days AND week_of_month), không có bản ghi nào trong DB. Chỉ ĐỌC — hôm nay muốn check-in thì vẫn dùng GET /daily-plans/today vì tiến độ ghi vào DailyPlanStop thật. Khoảng ngày tối đa 92 ngày một lần gọi.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MyVisitDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "dms.daily_plans.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_get_daily_plan",
        "operationId": "daily_plans_my_visits_list"
      }
    },
    "/api/v1/dms/daily-plans/my-week": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Lịch tuyến theo thứ của nhân viên",
        "description": "Trả về 7 ngày (T2..CN); mỗi ngày liệt kê các tuyến NV đang được gán trực ngày đó (theo Route.DayOfWeek) + số điểm bán mỗi tuyến.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MyWeekScheduleDto"
                }
              }
            }
          }
        },
        "x-scope": "dms.daily_plans.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_get_daily_plan",
        "operationId": "daily_plans_my_week_get"
      }
    },
    "/api/v1/dms/daily-plans/suggestions": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Danh sách gợi ý kế hoạch ngày",
        "description": "Lấy danh sách gợi ý PENDING cho ngày chỉ định. Nếu không truyền date, mặc định là ngày mai (ICT).",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DailyPlanSuggestionDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "dms.daily_plans.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_get_daily_plan",
        "operationId": "daily_plans_suggestions_list"
      }
    },
    "/api/v1/dms/orders": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Danh sách đơn hàng",
        "description": "Proxy Sales.GetOrders. Filter theo source, outlet, NV phụ trách, chi nhánh, status, ngày, khoảng giá trị đơn. Rep/Driver chỉ thấy đơn của mình — assignedTo giao với phạm vi, không mở rộng.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "source",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "outletId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "orderType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assignedTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "totalMin",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "totalMax",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "columnFilters",
            "in": "query",
            "style": "deepObject",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesOrderPagedDto"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable"
          }
        },
        "x-scope": "dms.orders.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_list_orders",
        "operationId": "orders_list"
      }
    },
    "/api/v1/dms/outlets": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Danh sách outlets",
        "description": "Query DMS DB. Multi-select filter: channelCodes, statuses, zoneIds, branchIds, routeIds, salesRepIds, tiers, ranks, hasCoordinates, q.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "channelCodes",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "statuses",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "zoneIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "branchIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "routeIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "salesRepIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "tiers",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "ranks",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "salesRepUnassigned",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "hasCoordinates",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "crmContactId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "careStatusIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "includeOrderStats",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "statsFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "statsTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "suspectedDuplicates",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutletDtoPagedResult"
                }
              }
            }
          }
        },
        "x-scope": "dms.outlets.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_list_outlets",
        "operationId": "outlets_list"
      }
    },
    "/api/v1/dms/routes": {
      "get": {
        "tags": [
          "dms"
        ],
        "summary": "Danh sách tuyến",
        "description": "Lấy danh sách tuyến bán hàng theo workspace. Hỗ trợ filter theo branch, zone, kênh, ngày trong tuần, nhân viên và tìm kiếm theo mã/tên tuyến.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "branchIds",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "zoneIds",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelCodes",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "daysOfWeek",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "employeeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteDtoPagedResult"
                }
              }
            }
          }
        },
        "x-scope": "dms.routes.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "dms_list_routes",
        "operationId": "routes_list"
      }
    },
    "/api/v1/einvoice/invoices": {
      "get": {
        "tags": [
          "einvoice"
        ],
        "summary": "Lấy danh sách hóa đơn có phân trang",
        "description": "Lọc theo trạng thái, ngày tháng, nguồn (sales_order/gym_contract/manual) và tìm kiếm theo số HĐ / tên người mua. Kết quả phân trang.",
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "DRAFT",
                "PENDING",
                "ISSUED",
                "ADJUSTED",
                "CANCELLED",
                "ERROR",
                "DELETED_AT_PROVIDER",
                "REPLACED_AT_PROVIDER",
                "ADJUSTED_AT_PROVIDER"
              ],
              "type": "string"
            }
          },
          {
            "name": "fromDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "toDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "keyword",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceDtoPagedResult"
                }
              }
            }
          }
        },
        "x-scope": "einvoice.invoices.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "einvoice_list_invoices",
        "operationId": "invoices_list"
      }
    },
    "/api/v1/einvoice/invoices/by-reference-code": {
      "get": {
        "tags": [
          "einvoice"
        ],
        "summary": "Liệt kê HĐĐT theo mã chứng từ (vd mã hợp đồng gym)",
        "description": "Trả về TẤT CẢ hóa đơn của 1 hợp đồng theo reference_code (gym key HĐ theo lần thu, nên xem theo HỢP ĐỒNG phải tra theo mã). Mới nhất trước.",
        "parameters": [
          {
            "name": "referenceType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "referenceCode",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/InvoiceDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "einvoice.invoices.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "einvoice_get_invoice",
        "operationId": "invoices_by_reference_code_get"
      }
    },
    "/api/v1/einvoice/invoices/{id}": {
      "get": {
        "tags": [
          "einvoice"
        ],
        "summary": "Lấy chi tiết hóa đơn",
        "description": "Trả về thông tin hóa đơn kèm danh sách dòng hàng.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "einvoice.invoices.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "einvoice_get_invoice",
        "operationId": "invoices_get"
      }
    },
    "/api/v1/einvoice/reports/summary": {
      "get": {
        "tags": [
          "einvoice"
        ],
        "summary": "Tổng hợp hóa đơn theo trạng thái",
        "description": "Đếm số lượng theo từng trạng thái (phát hành/chờ ký/nháp/lỗi/huỷ/đã gửi), doanh thu + thuế của HĐ đã phát hành, và cơ cấu theo nguồn. Lọc theo khoảng ngày.",
        "parameters": [
          {
            "name": "fromDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "toDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceSummaryDto"
                }
              }
            }
          }
        },
        "x-scope": "einvoice.reports.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "einvoice_get_report_summary",
        "operationId": "reports_summary_get"
      }
    },
    "/api/v1/einvoice/series": {
      "get": {
        "tags": [
          "einvoice"
        ],
        "summary": "Lấy danh sách ký hiệu hóa đơn",
        "description": "Lọc theo tài khoản HĐĐT (providerConfigId) và/hoặc provider — cả hai tùy chọn. Trả về cả active và inactive.",
        "parameters": [
          {
            "name": "providerCode",
            "in": "query",
            "schema": {
              "enum": [
                "Misa",
                "Vnpt",
                "Viettel",
                "Fpt",
                "Bkav",
                "WinInvoice",
                "None"
              ],
              "type": "string"
            }
          },
          {
            "name": "providerConfigId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SeriesDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "einvoice.series.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "einvoice_list_series",
        "operationId": "series_list"
      }
    },
    "/api/v1/einvoice/settings": {
      "get": {
        "tags": [
          "einvoice"
        ],
        "summary": "Lấy danh sách cấu hình provider",
        "description": "Trả về tất cả cấu hình provider của workspace. Credentials đã ẩn.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProviderConfigDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "einvoice.settings.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "einvoice_get_settings",
        "operationId": "settings_list"
      }
    },
    "/api/v1/hrm/attendance/devices": {
      "get": {
        "tags": [
          "hrm"
        ],
        "summary": "Danh sách thiết bị chấm công",
        "description": "Mặc định chỉ máy ĐANG dùng. includeInactive=true trả thêm máy đã Ngừng sử dụng (bình thường bị query filter giấu) — để màn quản trị bật lại hoặc xóa hẳn chúng.",
        "parameters": [
          {
            "name": "includeInactive",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AttendanceDeviceDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "hrm.attendance_devices.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "hrm_list_attendance_devices",
        "operationId": "attendance_devices_list"
      }
    },
    "/api/v1/hrm/attendance/clock-history/daily": {
      "get": {
        "tags": [
          "hrm"
        ],
        "summary": "P2 — Lịch sử chấm công gom theo ngày (có phân trang)",
        "description": "1 row / NV / ngày: firstIn, lastOut, scanCount, sources, manualEntryCount.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "employeeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "orgUnitId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfDailyClockRow"
                }
              }
            }
          }
        },
        "x-scope": "hrm.attendance_raw_punches.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "hrm_get_clock_history_daily",
        "operationId": "attendance_clock_history_daily_get"
      }
    },
    "/api/v1/hrm/attendance/clock-history/timeline/{employeeId}": {
      "get": {
        "tags": [
          "hrm"
        ],
        "summary": "P3 — Timeline 1 NV (union device + manual)",
        "description": "Trả mọi event chấm công theo time desc, badge source DEVICE/MANUAL.",
        "parameters": [
          {
            "name": "employeeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TimelineEventRow"
                  }
                }
              }
            }
          }
        },
        "x-scope": "hrm.attendance_raw_punches.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "hrm_get_clock_timeline",
        "operationId": "attendance_clock_history_timeline_get"
      }
    },
    "/api/v1/hrm/employees/{employeeId}/credentials": {
      "get": {
        "tags": [
          "hrm"
        ],
        "summary": "Danh sách credential đã đăng ký của nhân viên",
        "parameters": [
          {
            "name": "employeeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EmployeeDeviceCredentialDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "hrm.attendance_devices.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "hrm_list_employee_credentials",
        "operationId": "employees_credentials_list"
      }
    },
    "/api/v1/hrm/attendance/raw-punches": {
      "get": {
        "tags": [
          "hrm"
        ],
        "summary": "Liệt kê raw punch events",
        "description": "Filter theo employee/status/date range. Status: PENDING / PROCESSED / UNMATCHED / FAILED.",
        "parameters": [
          {
            "name": "employeeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "credentialType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deviceSerial",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "includeDuplicates",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfAttendanceRawPunchDto"
                }
              }
            }
          }
        },
        "x-scope": "hrm.attendance_raw_punches.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "hrm_list_raw_punches",
        "operationId": "attendance_raw_punches_list"
      }
    },
    "/api/v1/marketing/email-campaigns": {
      "get": {
        "tags": [
          "marketing"
        ],
        "summary": "Lấy danh sách email campaigns",
        "description": "Trả về danh sách phân trang các email campaign trong workspace. Có thể lọc theo status (Draft/Scheduled/Sending/Sent/…), từ khóa và `days` (chỉ lấy chiến dịch có ngày gửi/hẹn/tạo trong N ngày qua).",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfEmailCampaignDto"
                }
              }
            }
          }
        },
        "x-scope": "marketing.email_campaigns.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "marketing_list_email_campaigns",
        "operationId": "email_campaigns_list"
      }
    },
    "/api/v1/marketing/email-campaigns/merge-variables": {
      "get": {
        "tags": [
          "marketing"
        ],
        "summary": "Danh mục biến trộn dùng được trong email chiến dịch",
        "description": "Trả các nhóm biến mà email chiến dịch thực sự được điền lúc gửi (customer.*, contact.*, workspace.*, date.*, unsubscribe_url) kèm nhãn, ví dụ và nguồn dữ liệu. Không gồm trigger.* (chỉ có ở luồng tự động), trường tuỳ chỉnh của khách (customer.<khoá>) và biến riêng của chiến dịch (mergeTags).",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EmailMergeVariableGroupDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "marketing.email_campaigns.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "marketing_get_email_campaign",
        "operationId": "email_campaigns_merge_variables_list"
      }
    },
    "/api/v1/marketing/email-campaigns/{id}": {
      "get": {
        "tags": [
          "marketing"
        ],
        "summary": "Lấy chi tiết email campaign",
        "description": "Trả về thông tin đầy đủ của một email campaign theo ID.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailCampaignDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "marketing.email_campaigns.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "marketing_get_email_campaign",
        "operationId": "email_campaigns_get"
      }
    },
    "/api/v1/marketing/email-templates": {
      "get": {
        "tags": [
          "marketing"
        ],
        "summary": "Lấy danh sách email templates",
        "description": "Trả về danh sách phân trang các email template trong workspace. Có thể lọc theo category và từ khóa.",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfEmailTemplateListDto"
                }
              }
            }
          }
        },
        "x-scope": "marketing.email_templates.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "marketing_list_email_templates",
        "operationId": "email_templates_list"
      }
    },
    "/api/v1/marketing/google-integrations": {
      "get": {
        "tags": [
          "marketing"
        ],
        "summary": "Lấy danh sách Google integrations của workspace",
        "description": "Trả về tất cả kết nối Google đã thiết lập (Analytics, Search Console, Ads).",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GoogleIntegrationDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "marketing.integrations.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "marketing_list_integrations",
        "operationId": "google_integrations_list"
      }
    },
    "/api/v1/marketing/reports/overview": {
      "get": {
        "tags": [
          "marketing"
        ],
        "summary": "Tổng quan báo cáo marketing",
        "description": "Trả về KPIs tổng hợp, thống kê theo ngày và theo kênh trong khoảng thời gian chỉ định.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportOverviewDto"
                }
              }
            }
          }
        },
        "x-scope": "marketing.reports.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "marketing_get_report_overview",
        "operationId": "reports_overview_get"
      }
    },
    "/api/v1/marketing/settings/sender-info": {
      "get": {
        "tags": [
          "marketing"
        ],
        "summary": "Lấy danh sách sender profiles",
        "description": "Danh sách email người gửi đã được cấu hình cho workspace.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SenderProfileDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "marketing.sender_profiles.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "marketing_list_sender_profiles",
        "operationId": "settings_sender_info_get"
      }
    },
    "/api/v1/payment/intents/completed": {
      "get": {
        "tags": [
          "payment"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "referenceTypes",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "take",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CompletedIntentDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "payment.intents.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "payment_get_intent",
        "operationId": "intents_completed_get"
      }
    },
    "/api/v1/payment/intents/{id}": {
      "get": {
        "tags": [
          "payment"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "workspaceId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentIntentDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "payment.intents.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "payment_get_intent",
        "operationId": "intents_get"
      }
    },
    "/api/v1/payment/transactions": {
      "get": {
        "tags": [
          "payment"
        ],
        "parameters": [
          {
            "name": "providerCode",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "referenceType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "referenceId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "payerId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "fromDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "toDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetPaymentTransactionsResult"
                }
              }
            }
          }
        },
        "x-scope": "payment.transactions.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "payment_list_transactions",
        "operationId": "transactions_list"
      }
    },
    "/api/v1/payment/transactions/{id}": {
      "get": {
        "tags": [
          "payment"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentTransactionDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "payment.transactions.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "payment_get_transaction",
        "operationId": "transactions_get"
      }
    },
    "/api/v1/payment/refunds": {
      "get": {
        "tags": [
          "payment"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedRefundsResult"
                }
              }
            }
          }
        },
        "x-scope": "payment.refunds.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "payment_list_refunds",
        "operationId": "refunds_list"
      }
    },
    "/api/v1/payment/reports/overview": {
      "get": {
        "tags": [
          "payment"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentOverviewDto"
                }
              }
            }
          }
        },
        "x-scope": "payment.reports.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "payment_get_report_overview",
        "operationId": "payment_reports_overview_get"
      }
    },
    "/api/v1/payment/subscriptions": {
      "get": {
        "tags": [
          "payment"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "referenceType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "providerCode",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedSubscriptionsResult"
                }
              }
            }
          }
        },
        "x-scope": "payment.subscriptions.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "payment_list_subscriptions",
        "operationId": "subscriptions_list"
      }
    },
    "/api/v1/sales/customers": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Danh sách khách hàng",
        "description": "Lấy danh sách khách hàng theo workspace, có hỗ trợ lọc và phân trang.",
        "parameters": [
          {
            "name": "groupId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "smartView",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "crmContactId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignedTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "createdFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "createdTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "gender",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "birthdayMonth",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "lastTxnFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "lastTxnTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "revenueFrom",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "revenueTo",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "debtFrom",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "debtTo",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "createdBy",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortDir",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "f",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerListResult"
                }
              }
            }
          }
        },
        "x-scope": "sales.customers.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_list_customers",
        "operationId": "customers_list"
      }
    },
    "/api/v1/sales/orders/stats": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Thống kê đơn hàng theo trạng thái",
        "description": "Trả về số lượng đơn theo 4 nhóm: pending, processing, completed, cancelled. Áp dụng cùng bộ lọc với danh sách đơn hàng (trừ status).",
        "parameters": [
          {
            "name": "orderType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignedTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "crmContactId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentMethod",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "createdBy",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "hasDebt",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "outletId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryEmployeeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderStatsDto"
                }
              }
            }
          }
        },
        "x-scope": "sales.orders.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_order",
        "operationId": "orders_stats_get"
      }
    },
    "/api/v1/sales/orders/export": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Xuất danh sách đơn hàng ra Excel",
        "description": "Tạo async export job. Trả về jobId — poll GET /reports/export/{jobId} để lấy trạng thái và downloadUrl.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "orderType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paymentMethod",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignedTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "exportType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "columns",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "orderIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "outletId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryEmployeeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExportOrdersResult"
                }
              }
            }
          }
        },
        "x-scope": "sales.orders.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_order",
        "operationId": "orders_export_get"
      }
    },
    "/api/v1/sales/orders": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Danh sách đơn hàng",
        "description": "Filter: type, status, branch, date, khách hàng, phương thức thanh toán, người tạo, khoảng tiền, có công nợ, khung giờ của ngày đặt đơn (order_date ?? created_at) theo giờ VN (hourFrom/hourTo, 0-23, hourFrom <= hourTo), sản phẩm trong đơn (productId), đơn đã thu đủ tiền nhưng chưa hoàn thành (paidNotCompleted), điểm bán (outletId), NV giao hàng đã gán (deliveryEmployeeId). Tìm kiếm theo mã đơn / ghi chú. Sort: code, total, paid, debt, created_at, confirmed_at, completed_at, order_date. Kèm summary (Σ tổng tiền / đã thu / còn nợ theo bộ lọc). paymentBreakdown của mỗi đơn = tiền đã thu theo từng PTTT, gom từ phiếu thu (fallback payment_breakdown_json → payment_method). includePaymentMethods=true trả thêm paymentMethodsPresent = tập mã PTTT của TOÀN BỘ tập đã lọc để dựng cột động — ĐẮT (2 truy vấn quét cả tập), gửi khi đổi bộ lọc chứ đừng gửi mỗi lần lật trang.",
        "parameters": [
          {
            "name": "orderType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignedTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "crmContactId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentMethod",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "createdBy",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "totalFrom",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "totalTo",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "hasDebt",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "isDeleted",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "sourcePreOrderId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "channelCode",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hourFrom",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "hourTo",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "hasVat",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "vatExportStatus",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paidNotCompleted",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "columnFilters",
            "in": "query",
            "style": "deepObject",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          {
            "name": "outletId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryEmployeeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "includePaymentMethods",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "cashAccountId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "bankAccountId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "unassigned",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderListResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "sales.orders.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_list_orders",
        "operationId": "sales_orders_list"
      }
    },
    "/api/v1/sales/orders/{id}": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Chi tiết đơn hàng",
        "description": "`excludeReturnId`: bỏ qua phiếu hoàn đó khi tính `openReturnQuantity` từng dòng. Dành cho màn SỬA phiếu hoàn — không truyền thì chính phiếu đang sửa tự giữ chỗ số lượng của nó, mọi dòng ra 0 còn-trả-được và form sửa hiện trắng.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "excludeReturnId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "sales.orders.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_order",
        "operationId": "orders_get"
      }
    },
    "/api/v1/sales/products/stats": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Thống kê sản phẩm",
        "description": "Trả về 4 số: tổng hàng hóa, đang kinh doanh, có biến thể, sắp hết hàng.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductStatsDto"
                }
              }
            }
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_product",
        "operationId": "products_stats_get"
      }
    },
    "/api/v1/sales/products": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Danh sách sản phẩm",
        "description": "Hỗ trợ filter theo status, category, type. Tìm kiếm theo tên (partial) hoặc SKU (exact).",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "productType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "trackingType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          },
          {
            "name": "stockView",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attr",
            "in": "query",
            "style": "deepObject",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          {
            "name": "isSoldDirectly",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "supplierId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "brandId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "priceFrom",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "priceTo",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "stockFrom",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "stockTo",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "sortDir",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductListResult"
                }
              }
            }
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_list_products",
        "operationId": "products_list"
      }
    },
    "/api/v1/sales/products/deleted": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Danh sách sản phẩm đã xóa",
        "description": "Lấy sản phẩm đã soft delete. Hỗ trợ tìm kiếm theo tên/SKU. Mặc định sắp xếp theo ngày xóa mới nhất.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfDeletedProductDto"
                }
              }
            }
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_product",
        "operationId": "products_deleted_get"
      }
    },
    "/api/v1/sales/products/{id}": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Chi tiết sản phẩm",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_product",
        "operationId": "products_get"
      }
    },
    "/api/v1/sales/products/{id}/stock": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Tồn kho theo chi nhánh",
        "description": "Trả về số lượng tồn kho per chi nhánh từ stock_movements.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProductBranchStockDto"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_product_stock",
        "operationId": "products_stock_get"
      }
    },
    "/api/v1/sales/products/export": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Export danh sách sản phẩm",
        "description": "Async export. Trả về jobId để poll trạng thái.",
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "XLSX"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "productIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "brandId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "supplierId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "productType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "trackingType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stockView",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attr",
            "in": "query",
            "style": "deepObject",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          {
            "name": "reportType",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "PRODUCT_LIST"
            }
          },
          {
            "name": "columns",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted"
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_product",
        "operationId": "products_export_get"
      }
    },
    "/api/v1/sales/products/expiry-report": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Báo cáo lô hàng theo hạn sử dụng",
        "description": "Trả về danh sách lô sắp hết hạn hoặc đã hết hạn trong khoảng N ngày. categoryId: lọc theo nhóm hàng hoá (gồm cả nhóm con).",
        "parameters": [
          {
            "name": "daysThreshold",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 30
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "includeExpired",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfLotExpiryReportDto"
                }
              }
            }
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_product",
        "operationId": "products_expiry_report_get"
      }
    },
    "/api/v1/sales/products/unknown-lot-report": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Báo cáo hàng chưa xác định lô",
        "description": "Mỗi (sản phẩm × chi nhánh) một dòng: còn treo bao nhiêu ở lô giữ chỗ \"CHƯA-XÁC-ĐỊNH\", và đã bán ra bao nhiêu mà không truy được về lô nhà sản xuất. Cột còn-treo phải TEO dần theo thời gian. categoryId: lọc theo nhóm hàng hoá (gồm cả nhóm con).",
        "parameters": [
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "soldFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "soldTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfUnknownLotReportDto"
                }
              }
            }
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_product",
        "operationId": "products_unknown_lot_report_get"
      }
    },
    "/api/v1/sales/products/kit-availability": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Tồn bán được của combo (số bộ ghép được)",
        "description": "kitSkuIds: danh sách product_skus.id của combo (phân tách dấu phẩy, tối đa 200). Số bộ = MIN(tồn khả dụng ÷ SL mỗi bộ) trên các thành phần có tồn; null = không giới hạn (toàn dịch vụ). branchId bỏ trống = mọi chi nhánh.",
        "parameters": [
          {
            "name": "kitSkuIds",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/KitAvailabilityDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_product",
        "operationId": "products_kit_availability_get"
      }
    },
    "/api/v1/sales/products/stock-forecast": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Dự báo hết hàng",
        "description": "Tính tốc độ bán trung bình 30 ngày và dự báo số ngày hết hàng. Chỉ trả sản phẩm sắp hết trong DaysThreshold ngày.",
        "parameters": [
          {
            "name": "daysThreshold",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 30
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/StockForecastDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_product",
        "operationId": "products_stock_forecast_get"
      }
    },
    "/api/v1/sales/products/barcode-lookup": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Tra cứu sản phẩm theo mã vạch",
        "description": "Tìm sản phẩm theo mã sản phẩm hoặc mã SKU. Dùng cho chức năng quét mã vạch khi tạo đơn hàng.",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BarcodeProductDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "sales.products.view",
        "x-auth": [
          "oauth_user",
          "api_key"
        ],
        "x-mcp-tool": "sales_get_product",
        "operationId": "products_barcode_lookup_get"
      }
    },
    "/api/v1/crm/activities": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Danh sách hoạt động workspace",
        "description": "Variant workspace-wide của GET /contacts/{id}/activities — filter theo activityType, khoảng thời gian, contactId. Drill-down dashboard: dayOfWeek (0=Thứ Hai..6=Chủ Nhật) + hour (0-23) bucket theo giờ VN (UTC+7) — dùng cho heatmap; activityTypes (lặp lại query param) lọc nhiều loại cùng lúc, ưu tiên hơn activityType. Sắp theo occurredAt giảm dần. Không cache.",
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "activityType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fromDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "toDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "contactId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dayOfWeek",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "hour",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "activityTypes",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfWorkspaceActivityDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "crm.reports.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_recent_activities",
        "operationId": "activities_list"
      }
    },
    "/api/v1/crm/contacts/enrichment-suggestions": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Danh sách gợi ý làm giàu đang chờ duyệt",
        "description": "Địa chỉ/ý định LLM trích từ chat của khách. Truyền contactId để lọc theo 1 khách. Đây CHỈ là gợi ý — chưa áp vào contact cho tới khi duyệt (Accept).",
        "parameters": [
          {
            "name": "contactId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EnrichmentSuggestionDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "crm.contacts.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_contact",
        "operationId": "contacts_enrichment_suggestions_list"
      }
    },
    "/api/v1/crm/contacts": {
      "post": {
        "tags": [
          "crm"
        ],
        "summary": "Tạo contact mới",
        "description": "Tạo contact (ADR-CRM4 v1.3). lifecycle_stage = Lead nếu không gửi; gửi lifecycleStage = \"Customer\" để tạo thẳng khách hàng (nút Thêm khách hàng). ContactType IMMUTABLE sau khi tạo (INV-CRM4-11). referralCodeId (P5): chỉ quản lý (crm.settings.manage) — mã nhân viên + bỏ trống người phụ trách ⇒ chủ mã nhận lead.",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContactRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "crm.contacts.create",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "create_contact",
        "operationId": "contacts_create"
      },
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Lấy danh sách contacts",
        "description": "Hỗ trợ full-text search, filter theo tier, tag, ngày tạo, nguồn, phụ trách, ngành, loại khách hàng, trùng lặp. Drill-down dashboard: customerCreatedFrom/customerCreatedTo (có CustomerProfile tạo trong khoảng), inactiveDays=N (không có activity nào trong N ngày gần nhất). Kết quả phân trang.",
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tier",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hasCustomerProfile",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "tagId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "fromDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "toDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "lifecycleStage",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assigneeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "industryId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "duplicatesOnly",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "lifecycleStages",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "customerGroupId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactStatusId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerCreatedFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "customerCreatedTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "inactiveDays",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "f",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortDescending",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "columnFilters",
            "in": "query",
            "style": "deepObject",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "allBranches",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "slaOverdue",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfContactSummaryDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "crm.contacts.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "search_contacts",
        "operationId": "contacts_list"
      }
    },
    "/api/v1/crm/contacts/branch-transfer-targets": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Chi nhánh đích để chuyển khách (mọi chi nhánh của workspace)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BranchDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "crm.contacts.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_contact",
        "operationId": "contacts_branch_transfer_targets_list"
      }
    },
    "/api/v1/crm/contacts/branch-lookup": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Tra khách theo đúng SĐT/mã (kể cả ngoài phạm vi)",
        "description": "Dùng khi ô tìm không ra mà tạo mới báo trùng SĐT. Chỉ khớp CHÍNH XÁC (SĐT mọi cách viết 0/84/+84, hoặc mã khách), tối đa 5. Khách người gọi không được xem thì SĐT che 3 số giữa. canClaim = có quyền crm.contacts.claim_branch.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ContactBranchLookupDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "crm.contacts.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_contact",
        "operationId": "contacts_branch_lookup_get"
      }
    },
    "/api/v1/crm/contacts/facets": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Đếm sẵn theo trường lọc (facet)",
        "description": "GROUP BY qua đúng query đã scope quyền + đã áp FilterRules (?f=). fields=lifecycle_stage,lead_tier,source… Trả code → { value → count }.",
        "parameters": [
          {
            "name": "fields",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "f",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "integer",
                      "format": "int32"
                    }
                  }
                }
              }
            }
          }
        },
        "x-scope": "crm.contacts.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_contact",
        "operationId": "contacts_facets_list"
      }
    },
    "/api/v1/crm/contacts/stats": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Thống kê KPI contacts",
        "description": "Trả về tổng số contacts, số contacts có customer profile, phân bố theo tier (Standard/Premium/Vip) và theo lifecycle stage. Tôn trọng data scope giống GET /contacts.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactListStatsDto"
                }
              }
            }
          }
        },
        "x-scope": "crm.contacts.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_contact",
        "operationId": "contacts_stats_get"
      }
    },
    "/api/v1/crm/contacts/{id}": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Lấy chi tiết contact",
        "description": "Bao gồm thông tin customer profile, tags, leads liên kết và thông tin nhà cung cấp từ Sales.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "crm.contacts.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_contact",
        "operationId": "contacts_get"
      }
    },
    "/api/v1/crm/opportunities": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Lấy danh sách opportunities",
        "description": "Hỗ trợ full-text search (q: name/code) + filter theo status, stage, assignee, contact, lead. Drill-down dashboard: sourceId (nguồn của contact liên kết), wonFrom/wonTo (khoảng WonAt), overdue=true (Open + quá hạn đóng dự kiến theo ngày VN), valueGte/valueLte (khoảng giá trị dự kiến — VND), campaignId (chiến dịch nguồn). sortBy: nextCall (hạn task mở sớm nhất) | expectedClose | createdAt (mặc định). nextCallFrom/nextCallTo: lọc cơ hội có hạn task mở sớm nhất trong khoảng ngày (chip 'hôm nay' = From=To=today, 'quá hạn' = To=hôm qua). Hỗ trợ cả chế độ list và kanban.",
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stageId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assigneeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "leadId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "fromDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "toDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "wonFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "wonTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "overdue",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "pipelineId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "valueGte",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "valueLte",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "f",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "nextCallFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "nextCallTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfOpportunitySummaryDto"
                }
              }
            }
          }
        },
        "x-scope": "crm.opportunities.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_deal_pipeline",
        "operationId": "opportunities_list"
      }
    },
    "/api/v1/crm/opportunities/stats": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Thống kê tổng quan cơ hội kinh doanh",
        "description": "Trả về tổng cơ hội (open/won/lost), doanh thu dự kiến, dự báo doanh thu, tỷ lệ thắng, mới trong N ngày, phân bổ theo pipeline stage.",
        "parameters": [
          {
            "name": "periodDays",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpportunityStatsDto"
                }
              }
            }
          }
        },
        "x-scope": "crm.opportunities.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_deal",
        "operationId": "opportunities_stats_get"
      }
    },
    "/api/v1/crm/opportunities/forecast": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Dự báo cơ hội theo bộ lọc",
        "description": "Trả về tổng số / đang mở / quá hạn + tổng giá trị dự kiến + giá trị trọng số (Σ giá trị × xác suất), tính trên CÙNG tập đã lọc như danh sách (bộ lọc nhanh + FilterRules ?f=). Dùng cho strip đầu màn.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stageId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assigneeId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "leadId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "fromDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "toDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "wonFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "wonTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "overdue",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "pipelineId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "valueGte",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "valueLte",
            "in": "query",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "f",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpportunityForecastStripDto"
                }
              }
            }
          }
        },
        "x-scope": "crm.opportunities.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_deal",
        "operationId": "opportunities_forecast_get"
      }
    },
    "/api/v1/crm/opportunities/{id}": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Lấy chi tiết opportunity",
        "description": "Bao gồm đầy đủ thông tin opportunity, stage, customFields.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpportunityDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "crm.opportunities.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_deal",
        "operationId": "opportunities_get"
      }
    },
    "/api/v1/crm/opportunities/pipeline-stages": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Danh sách giai đoạn pipeline (chỉ đọc)",
        "description": "Cùng dữ liệu với GET /settings/pipeline-stages nhưng chỉ cần quyền xem cơ hội. Nhân viên bán hàng không có crm.settings.manage nên không gọi được endpoint kia.",
        "parameters": [
          {
            "name": "pipelineId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PipelineStageDto"
                  }
                }
              }
            }
          }
        },
        "x-scope": "crm.opportunities.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_deal",
        "operationId": "opportunities_pipeline_stages_list"
      }
    },
    "/api/v1/crm/opportunities/{id}/stage": {
      "patch": {
        "tags": [
          "crm"
        ],
        "summary": "Chuyển pipeline stage",
        "description": "Di chuyển opportunity sang stage khác. Không cho phép nếu WON/LOST (RC-03).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveOpportunityStageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpportunityDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "crm.opportunities.manage",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "update_deal_stage",
        "operationId": "opportunities_stage_update"
      }
    },
    "/api/v1/crm/opportunities/stale": {
      "get": {
        "tags": [
          "crm"
        ],
        "summary": "Xem trước cơ hội quá hạn lâu",
        "description": "Cơ hội còn Open nhưng ngày dự kiến chốt đã qua quá số ngày chỉ định. Trả tổng số, tổng giá trị ước tính và một trang danh sách. Con số totalCount trả về ở đây chính là expectedCount phải gửi khi đóng hàng loạt.",
        "parameters": [
          {
            "name": "daysOverdue",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 90
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StaleOpportunitiesDto"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "crm.opportunities.view",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "get_deal",
        "operationId": "opportunities_stale_get"
      }
    },
    "/api/v1/crm/tasks": {
      "post": {
        "tags": [
          "crm"
        ],
        "summary": "Tạo task mới",
        "description": "Tạo task. RC-10: chỉ được liên kết với 1 trong 3: contactId, opportunityId hoặc ticketId. Vi phạm → 422 TASK_SINGLE_LINK_VIOLATION.",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTaskRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDetailDto"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "crm.tasks.manage",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "create_task",
        "operationId": "tasks_create"
      }
    },
    "/api/v1/comm/conversations/{id}/messages": {
      "post": {
        "tags": [
          "comm"
        ],
        "summary": "Gửi tin nhắn",
        "description": "Agent gửi tin nhắn vào hội thoại. Hỗ trợ idempotency qua clientId. Không thể gửi vào hội thoại Resolved hoặc BotHandling.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessageRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "x-scope": "comm.conversations.handle",
        "x-auth": [
          "api_key"
        ],
        "x-mcp-tool": "send_zalo_message",
        "operationId": "conversations_messages_create"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key"
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "PagedResultOfRecordDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "RecordDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tableId": {
            "type": "string",
            "format": "uuid"
          },
          "data": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "rowColor": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ListRecordsRequest": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "filter": {
            "$ref": "#/components/schemas/RecordFilter"
          },
          "sort": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordSort"
            },
            "nullable": true
          },
          "colorRules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordColorRule"
            },
            "nullable": true
          },
          "groupFieldId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "RecordColorRule": {
        "type": "object",
        "properties": {
          "color": {
            "type": "string",
            "nullable": true
          },
          "filter": {
            "$ref": "#/components/schemas/RecordFilter"
          }
        },
        "additionalProperties": false
      },
      "RecordFilter": {
        "type": "object",
        "properties": {
          "conjunction": {
            "type": "string",
            "nullable": true
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FilterCondition"
            },
            "nullable": true
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordFilter"
            },
            "nullable": true
          },
          "hasCriteria": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "FilterCondition": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string",
            "nullable": true
          },
          "operator": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "RecordSort": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string",
            "nullable": true
          },
          "descending": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "RecordUpdateResult": {
        "type": "object",
        "properties": {
          "applied": {
            "type": "boolean"
          },
          "conflicts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordCellConflictDto"
            },
            "nullable": true
          },
          "messageKey": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "RecordCellConflictDto": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string",
            "nullable": true
          },
          "fieldName": {
            "type": "string",
            "nullable": true
          },
          "currentValue": {
            "type": "string",
            "nullable": true
          },
          "submittedValue": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateRecordRequest": {
        "type": "object",
        "properties": {
          "data": {
            "nullable": true
          },
          "replace": {
            "type": "boolean"
          },
          "expectedValues": {
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BatchDeleteRecordsRequest": {
        "type": "object",
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BatchUpdateRecordsRequest": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchUpdateItemRequest"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BatchUpdateItemRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "data": {
            "nullable": true
          },
          "replace": {
            "type": "boolean"
          }
        },
        "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": {}
      },
      "CreateRecordRequest": {
        "type": "object",
        "properties": {
          "data": {
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CommentRequest": {
        "type": "object",
        "properties": {
          "comment": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ApprovalInstanceDetailDto": {
        "type": "object",
        "properties": {
          "instance": {
            "$ref": "#/components/schemas/ApprovalInstanceDto"
          },
          "tasks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalTaskDto"
            },
            "nullable": true
          },
          "timeline": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalTimelineDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ApprovalTimelineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "taskId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "action": {
            "type": "string",
            "nullable": true
          },
          "actorId": {
            "type": "string",
            "format": "uuid"
          },
          "comment": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "ApprovalTaskDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "instanceId": {
            "type": "string",
            "format": "uuid"
          },
          "nodeId": {
            "type": "string",
            "format": "uuid"
          },
          "approverId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "taskKind": {
            "type": "string",
            "nullable": true
          },
          "comment": {
            "type": "string",
            "nullable": true
          },
          "actedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "originTaskId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "position": {
            "type": "integer",
            "format": "int32"
          },
          "dueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "escalatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "delegatedForUserId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ApprovalInstanceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "definitionId": {
            "type": "string",
            "format": "uuid"
          },
          "definitionCode": {
            "type": "string",
            "nullable": true
          },
          "applicantId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "formValue": {
            "type": "string",
            "nullable": true
          },
          "currentNodeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "enrollmentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "definitionName": {
            "type": "string",
            "nullable": true
          },
          "myPendingTaskId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfApprovalInstanceDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalInstanceDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "CreateInstanceRequest": {
        "type": "object",
        "properties": {
          "definitionCode": {
            "type": "string",
            "nullable": true
          },
          "formValue": {
            "type": "string",
            "nullable": true
          },
          "freeApprovers": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "QueueListResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QueueSummaryDto"
            },
            "nullable": true
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "QueueSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "strategy": {
            "type": "string",
            "nullable": true
          },
          "maxWaitSec": {
            "type": "integer",
            "format": "int32"
          },
          "ringTimeoutSec": {
            "type": "integer",
            "format": "int32"
          },
          "overflowAction": {
            "type": "string",
            "nullable": true
          },
          "serviceLevelThresholdSec": {
            "type": "integer",
            "format": "int32"
          },
          "serviceLevelTarget": {
            "type": "number",
            "format": "double"
          },
          "isActive": {
            "type": "boolean"
          },
          "agentCount": {
            "type": "integer",
            "format": "int32"
          },
          "activeCallers": {
            "type": "integer",
            "format": "int32"
          },
          "inUse": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "PhoneNumberListResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PhoneNumberDto"
            },
            "nullable": true
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "PhoneNumberDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "inboundSipTrunkId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "outboundSipTrunkId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "didNumber": {
            "type": "string",
            "nullable": true
          },
          "direction": {
            "type": "string",
            "nullable": true
          },
          "routingTargetType": {
            "type": "string",
            "nullable": true
          },
          "routingTargetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "routingTargetName": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "inboundSipTrunkName": {
            "type": "string",
            "nullable": true
          },
          "outboundSipTrunkName": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "isDefaultOutboundCid": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "IvrFlowListResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IvrFlowSummaryDto"
            },
            "nullable": true
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "IvrFlowSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "version": {
            "type": "integer",
            "format": "int32"
          },
          "nodeCount": {
            "type": "integer",
            "format": "int32"
          },
          "isLinkedToDid": {
            "type": "boolean"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "CampaignListResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignSummaryDto"
            },
            "nullable": true
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "CampaignSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "dialerMode": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "callerId": {
            "type": "string",
            "nullable": true
          },
          "concurrentCalls": {
            "type": "integer",
            "format": "int32"
          },
          "totalContacts": {
            "type": "integer",
            "format": "int32"
          },
          "calledContacts": {
            "type": "integer",
            "format": "int32"
          },
          "completedContacts": {
            "type": "integer",
            "format": "int32"
          },
          "pendingContacts": {
            "type": "integer",
            "format": "int32"
          },
          "progressPercent": {
            "type": "number",
            "format": "float"
          },
          "startDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "endDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "CallListResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallSummaryDto"
            },
            "nullable": true
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "CallSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "callUuid": {
            "type": "string",
            "nullable": true
          },
          "direction": {
            "type": "string",
            "nullable": true
          },
          "callerNumber": {
            "type": "string",
            "nullable": true
          },
          "calleeNumber": {
            "type": "string",
            "nullable": true
          },
          "agentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "agentName": {
            "type": "string",
            "nullable": true
          },
          "queueId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "queueName": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "answeredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "waitDurationSec": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "talkDurationSec": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "hasRecording": {
            "type": "boolean"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "csatScore": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "ticketId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "orderId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "crmContactId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "crmContactName": {
            "type": "string",
            "nullable": true
          },
          "crmContactTier": {
            "type": "string",
            "nullable": true
          },
          "openTicketCount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "agentAvatar": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "isInternal": {
            "type": "boolean"
          },
          "disposition": {
            "type": "string",
            "nullable": true
          },
          "failureReason": {
            "$ref": "#/components/schemas/FailureReasonDto"
          }
        },
        "additionalProperties": false
      },
      "FailureReasonDto": {
        "type": "object",
        "properties": {
          "reasonKey": {
            "type": "string",
            "nullable": true
          },
          "culprit": {
            "type": "string",
            "nullable": true
          },
          "actionKey": {
            "type": "string",
            "nullable": true
          },
          "sipCode": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "sipReason": {
            "type": "string",
            "nullable": true
          },
          "hangupCause": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CallFlowListResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallFlowSummaryDto"
            },
            "nullable": true
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "CallFlowSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "triggerType": {
            "type": "string",
            "nullable": true
          },
          "version": {
            "type": "integer",
            "format": "int32"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "AgentListResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentSummaryDto"
            },
            "nullable": true
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "AgentSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "userId": {
            "type": "string",
            "format": "uuid"
          },
          "displayName": {
            "type": "string",
            "nullable": true
          },
          "avatar": {
            "type": "string",
            "nullable": true
          },
          "extension": {
            "type": "string",
            "nullable": true
          },
          "sipUsername": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "deviceType": {
            "type": "string",
            "nullable": true
          },
          "skillGroup": {
            "type": "string",
            "nullable": true
          },
          "level": {
            "type": "integer",
            "format": "int32"
          },
          "isActive": {
            "type": "boolean"
          },
          "queueIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "nullable": true
          },
          "queueNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "outboundPhoneNumberId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "outboundPhoneNumberDidNumber": {
            "type": "string",
            "nullable": true
          },
          "agentCode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "RouteDtoPagedResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "RouteDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "routeCode": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "channelCode": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "zoneId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid"
          },
          "dayOfWeek": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "nullable": true
          },
          "visitFrequency": {
            "type": "string",
            "nullable": true
          },
          "vehicleType": {
            "type": "string",
            "nullable": true
          },
          "colorHex": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "stopCount": {
            "type": "integer",
            "format": "int32"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "assignedCount": {
            "type": "integer",
            "format": "int32"
          },
          "startDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "todayVisitCount": {
            "type": "integer",
            "format": "int32"
          },
          "todayCompletedCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "OutletDtoPagedResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutletDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "OutletDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "outletCode": {
            "type": "string",
            "nullable": true
          },
          "outletName": {
            "type": "string",
            "nullable": true
          },
          "channelCode": {
            "type": "string",
            "nullable": true
          },
          "outletStatus": {
            "enum": [
              "Active",
              "TempClosed",
              "Closed",
              "Prospect"
            ],
            "type": "string"
          },
          "gpsLat": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "gpsLng": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "zoneId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "visitFrequency": {
            "enum": [
              "Daily",
              "Weekly",
              "Biweekly",
              "Monthly"
            ],
            "type": "string"
          },
          "ownerName": {
            "type": "string",
            "nullable": true
          },
          "ownerPhone": {
            "type": "string",
            "nullable": true
          },
          "ownerEmail": {
            "type": "string",
            "nullable": true
          },
          "lastCheckinAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "assignedRepId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "assignedRepCode": {
            "type": "string",
            "nullable": true
          },
          "assignedRepName": {
            "type": "string",
            "nullable": true
          },
          "tier": {
            "type": "string",
            "nullable": true
          },
          "rank": {
            "type": "string",
            "nullable": true
          },
          "routeCode": {
            "type": "string",
            "nullable": true
          },
          "assignedReps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutletAssignedRepDto"
            },
            "nullable": true
          },
          "careStatusId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "careStatusName": {
            "type": "string",
            "nullable": true
          },
          "careStatusColor": {
            "type": "string",
            "nullable": true
          },
          "orderCount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "orderRevenue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "lastOrderAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "taxCode": {
            "type": "string",
            "nullable": true
          },
          "duplicateGroup": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OutletAssignedRepDto": {
        "type": "object",
        "properties": {
          "employeeId": {
            "type": "string",
            "format": "uuid"
          },
          "employeeCode": {
            "type": "string",
            "nullable": true
          },
          "employeeName": {
            "type": "string",
            "nullable": true
          },
          "roleType": {
            "type": "string",
            "nullable": true
          },
          "routeCodes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SalesOrderPagedDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalesOrderDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totals": {
            "$ref": "#/components/schemas/SalesOrderTotalsDto"
          }
        },
        "additionalProperties": false
      },
      "SalesOrderTotalsDto": {
        "type": "object",
        "properties": {
          "subtotal": {
            "type": "number",
            "format": "double"
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "paidAmount": {
            "type": "number",
            "format": "double"
          },
          "debtAmount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "SalesOrderDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "orderCode": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "totalAmount": {
            "type": "number",
            "format": "double"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "paymentMethod": {
            "type": "string",
            "nullable": true
          },
          "paymentStatus": {
            "type": "string",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "assignedTo": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "assignedToName": {
            "type": "string",
            "nullable": true
          },
          "crmContactId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "orderType": {
            "type": "string",
            "nullable": true
          },
          "outletId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "outletName": {
            "type": "string",
            "nullable": true
          },
          "depositAmount": {
            "type": "number",
            "format": "double"
          },
          "expectedDeliveryDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "paidAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "debtAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "itemCount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "subtotal": {
            "type": "number",
            "format": "double"
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "shippingFee": {
            "type": "number",
            "format": "double"
          },
          "totalQuantity": {
            "type": "number",
            "format": "double"
          },
          "customerCode": {
            "type": "string",
            "nullable": true
          },
          "deliveryEmployeeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "deliveryEmployeeName": {
            "type": "string",
            "nullable": true
          },
          "deliveryId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "deliveryStatus": {
            "type": "string",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastPaymentDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalesOrderPaymentDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SalesOrderPaymentDto": {
        "type": "object",
        "properties": {
          "receiptId": {
            "type": "string",
            "format": "uuid"
          },
          "receiptCode": {
            "type": "string",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "paymentMethod": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "DailyPlanSuggestionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "suggestedDate": {
            "type": "string",
            "format": "date"
          },
          "outletId": {
            "type": "string",
            "format": "uuid"
          },
          "employeeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "visitFrequency": {
            "type": "string",
            "nullable": true
          },
          "daysSinceLastVisit": {
            "type": "integer",
            "format": "int32"
          },
          "priority": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "MyWeekScheduleDto": {
        "type": "object",
        "properties": {
          "days": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MyWeekDayDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MyWeekDayDto": {
        "type": "object",
        "properties": {
          "dayOfWeek": {
            "type": "integer",
            "format": "int32"
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MyWeekRouteDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MyWeekRouteDto": {
        "type": "object",
        "properties": {
          "routeId": {
            "type": "string",
            "format": "uuid"
          },
          "routeCode": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "stopCount": {
            "type": "integer",
            "format": "int32"
          },
          "roleType": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MyVisitDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "outletId": {
            "type": "string",
            "format": "uuid"
          },
          "outletName": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "gpsLat": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "gpsLng": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "routeId": {
            "type": "string",
            "format": "uuid"
          },
          "routeCode": {
            "type": "string",
            "nullable": true
          },
          "visitOrder": {
            "type": "integer",
            "format": "int32"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "checkinAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "checkoutAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DmsMyDayPlanDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "employeeId": {
            "type": "string",
            "format": "uuid"
          },
          "planDate": {
            "type": "string",
            "format": "date"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteSummary"
            },
            "nullable": true
          },
          "totalStops": {
            "type": "integer",
            "format": "int32"
          },
          "completedStops": {
            "type": "integer",
            "format": "int32"
          },
          "skippedStops": {
            "type": "integer",
            "format": "int32"
          },
          "stops": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DmsMyDayStopDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DmsMyDayStopDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "routeStopId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "routeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "routeName": {
            "type": "string",
            "nullable": true
          },
          "outletId": {
            "type": "string",
            "format": "uuid"
          },
          "outletName": {
            "type": "string",
            "nullable": true
          },
          "outletAddress": {
            "type": "string",
            "nullable": true
          },
          "stopSequence": {
            "type": "integer",
            "format": "int32"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "checkinAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "checkoutAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "skipReason": {
            "type": "string",
            "nullable": true
          },
          "orderCount": {
            "type": "integer",
            "format": "int32"
          },
          "checklistScore": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "gpsLat": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "gpsLng": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "RouteSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DailyPlanDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "employeeId": {
            "type": "string",
            "format": "uuid"
          },
          "employeeName": {
            "type": "string",
            "nullable": true
          },
          "planDate": {
            "type": "string",
            "format": "date"
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteSummary"
            },
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "totalStops": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "UnassignedEmployeeDto": {
        "type": "object",
        "properties": {
          "employeeId": {
            "type": "string",
            "format": "uuid"
          },
          "employeeCode": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "roleType": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DailyPlanDtoPagedResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DailyPlanDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "CheckinLogDtoPagedResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckinLogDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "CheckinLogDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "outletId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "outletName": {
            "type": "string",
            "nullable": true
          },
          "employeeId": {
            "type": "string",
            "format": "uuid"
          },
          "employeeName": {
            "type": "string",
            "nullable": true
          },
          "routeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "dailyPlanId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "checkinAt": {
            "type": "string",
            "format": "date-time"
          },
          "checkoutAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "checkinLat": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "checkinLng": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "checkinAddress": {
            "type": "string",
            "nullable": true
          },
          "distanceFromOutlet": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "isValid": {
            "type": "boolean"
          },
          "invalidReason": {
            "type": "string",
            "nullable": true
          },
          "photoKey": {
            "type": "string",
            "nullable": true
          },
          "photoKeys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "enum": [
              "Outlet",
              "Field"
            ],
            "type": "string"
          },
          "photoUrls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "isAutoClosed": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "CatalogProductPagedDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogProductDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "CatalogProductDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "unit": {
            "type": "string",
            "nullable": true
          },
          "price": {
            "type": "number",
            "format": "double"
          },
          "categoryId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "trackingType": {
            "type": "string",
            "nullable": true
          },
          "taxRate": {
            "type": "number",
            "format": "double"
          },
          "defaultSkuId": {
            "type": "string",
            "nullable": true
          },
          "unitConversions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogUnitConversionDto"
            },
            "nullable": true
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogProductVariantDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CatalogProductVariantDto": {
        "type": "object",
        "properties": {
          "variantId": {
            "type": "string",
            "format": "uuid"
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "currentPrice": {
            "type": "number",
            "format": "double"
          },
          "qtyAvailable": {
            "type": "integer",
            "format": "int64"
          },
          "skuId": {
            "type": "string",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CatalogUnitConversionDto": {
        "type": "object",
        "properties": {
          "unitCode": {
            "type": "string",
            "nullable": true
          },
          "unitName": {
            "type": "string",
            "nullable": true
          },
          "isBase": {
            "type": "boolean"
          },
          "conversionToBase": {
            "type": "number",
            "format": "double"
          },
          "sellingPrice": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProviderConfigDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workspaceId": {
            "type": "string",
            "format": "uuid"
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "invoiceContext": {
            "enum": [
              "SalesInvoice",
              "OperatorInvoice"
            ],
            "type": "string"
          },
          "providerCode": {
            "enum": [
              "Misa",
              "Vnpt",
              "Viettel",
              "Fpt",
              "Bkav",
              "WinInvoice",
              "None"
            ],
            "type": "string"
          },
          "displayName": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "isTestMode": {
            "type": "boolean"
          },
          "autoIssueEnabled": {
            "type": "boolean"
          },
          "autoIssueHour": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "issuerTaxCode": {
            "type": "string",
            "nullable": true
          },
          "issuerName": {
            "type": "string",
            "nullable": true
          },
          "issuerAddress": {
            "type": "string",
            "nullable": true
          },
          "issuerPhone": {
            "type": "string",
            "nullable": true
          },
          "issuerEmail": {
            "type": "string",
            "nullable": true
          },
          "issuerBankName": {
            "type": "string",
            "nullable": true
          },
          "issuerBankAccount": {
            "type": "string",
            "nullable": true
          },
          "defaultVatRate": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "configPublic": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "SeriesDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workspaceId": {
            "type": "string",
            "format": "uuid"
          },
          "providerConfigId": {
            "type": "string",
            "format": "uuid"
          },
          "providerCode": {
            "enum": [
              "Misa",
              "Vnpt",
              "Viettel",
              "Fpt",
              "Bkav",
              "WinInvoice",
              "None"
            ],
            "type": "string"
          },
          "templateNo": {
            "type": "string",
            "nullable": true
          },
          "seriesCode": {
            "type": "string",
            "nullable": true
          },
          "fullCode": {
            "type": "string",
            "nullable": true
          },
          "invoiceType": {
            "enum": [
              "VAT",
              "NON_VAT",
              "EXPORT"
            ],
            "type": "string"
          },
          "kind": {
            "enum": [
              "Vat",
              "Sales",
              "Ticket",
              "DeliveryNote"
            ],
            "type": "string",
            "nullable": true
          },
          "formKind": {
            "enum": [
              "Normal",
              "CashRegister"
            ],
            "type": "string",
            "nullable": true
          },
          "hasTaxAuthorityCode": {
            "type": "boolean",
            "nullable": true
          },
          "year": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "registeredAt": {
            "type": "string",
            "format": "date"
          },
          "fromNumber": {
            "type": "integer",
            "format": "int64"
          },
          "currentNumber": {
            "type": "integer",
            "format": "int64"
          },
          "isActive": {
            "type": "boolean"
          },
          "isDefault": {
            "type": "boolean"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "InvoiceSummaryDto": {
        "type": "object",
        "properties": {
          "totalAll": {
            "type": "integer",
            "format": "int32"
          },
          "totalIssued": {
            "type": "integer",
            "format": "int32"
          },
          "totalPending": {
            "type": "integer",
            "format": "int32"
          },
          "totalDraft": {
            "type": "integer",
            "format": "int32"
          },
          "totalError": {
            "type": "integer",
            "format": "int32"
          },
          "totalCancelled": {
            "type": "integer",
            "format": "int32"
          },
          "totalAmount": {
            "type": "number",
            "format": "double"
          },
          "totalTaxAmount": {
            "type": "number",
            "format": "double"
          },
          "bySource": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceBreakdownDto"
            },
            "nullable": true
          },
          "periodFrom": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "periodTo": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SourceBreakdownDto": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "nullable": true
          },
          "count": {
            "type": "integer",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "InvoiceDetailDto": {
        "type": "object",
        "properties": {
          "invoice": {
            "$ref": "#/components/schemas/InvoiceDto"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceItemDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "InvoiceItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "lineNumber": {
            "type": "integer",
            "format": "int32"
          },
          "productCode": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "unit": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "format": "double"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "discountPct": {
            "type": "number",
            "format": "double"
          },
          "lineSubtotal": {
            "type": "number",
            "format": "double"
          },
          "vatRate": {
            "type": "number",
            "format": "double"
          },
          "vatAmount": {
            "type": "number",
            "format": "double"
          },
          "lineTotal": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "InvoiceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workspaceId": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceContext": {
            "enum": [
              "SalesInvoice",
              "OperatorInvoice"
            ],
            "type": "string"
          },
          "providerCode": {
            "enum": [
              "Misa",
              "Vnpt",
              "Viettel",
              "Fpt",
              "Bkav",
              "WinInvoice",
              "None"
            ],
            "type": "string"
          },
          "seriesId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "invoiceNumber": {
            "type": "string",
            "nullable": true
          },
          "invoiceSeriesCode": {
            "type": "string",
            "nullable": true
          },
          "cqtCode": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "enum": [
              "DRAFT",
              "PENDING",
              "ISSUED",
              "ADJUSTED",
              "CANCELLED",
              "ERROR",
              "DELETED_AT_PROVIDER",
              "REPLACED_AT_PROVIDER",
              "ADJUSTED_AT_PROVIDER"
            ],
            "type": "string"
          },
          "referenceType": {
            "type": "string",
            "nullable": true
          },
          "referenceId": {
            "type": "string",
            "format": "uuid"
          },
          "referenceCode": {
            "type": "string",
            "nullable": true
          },
          "invoiceDate": {
            "type": "string",
            "format": "date"
          },
          "taxPeriod": {
            "type": "string",
            "nullable": true
          },
          "buyerName": {
            "type": "string",
            "nullable": true
          },
          "buyerTaxCode": {
            "type": "string",
            "nullable": true
          },
          "buyerAddress": {
            "type": "string",
            "nullable": true
          },
          "buyerPhone": {
            "type": "string",
            "nullable": true
          },
          "buyerEmail": {
            "type": "string",
            "nullable": true
          },
          "buyerIdNo": {
            "type": "string",
            "nullable": true
          },
          "buyerIdType": {
            "type": "string",
            "nullable": true
          },
          "subtotal": {
            "type": "number",
            "format": "double"
          },
          "vatRate": {
            "type": "number",
            "format": "double"
          },
          "vatAmount": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "paymentMethodLabel": {
            "type": "string",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "cancelReason": {
            "type": "string",
            "nullable": true
          },
          "issuedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "buyerContactName": {
            "type": "string",
            "nullable": true
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "invoiceDateManual": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "InvoiceDtoPagedResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfAttendanceRawPunchDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttendanceRawPunchDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "AttendanceRawPunchDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "employeeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "employeeName": {
            "type": "string",
            "nullable": true
          },
          "employeeCode": {
            "type": "string",
            "nullable": true
          },
          "deviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "deviceSerial": {
            "type": "string",
            "nullable": true
          },
          "deviceName": {
            "type": "string",
            "nullable": true
          },
          "deviceUserId": {
            "type": "string",
            "nullable": true
          },
          "punchedAt": {
            "type": "string",
            "format": "date-time"
          },
          "credentialType": {
            "type": "string",
            "nullable": true
          },
          "ingestSource": {
            "type": "string",
            "nullable": true
          },
          "processStatus": {
            "type": "string",
            "nullable": true
          },
          "processError": {
            "type": "string",
            "nullable": true
          },
          "photoStorageKey": {
            "type": "string",
            "nullable": true
          },
          "photoUrl": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "masterPunchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "EmployeeDeviceCredentialDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "employeeId": {
            "type": "string",
            "format": "uuid"
          },
          "deviceId": {
            "type": "string",
            "format": "uuid"
          },
          "deviceUserId": {
            "type": "string",
            "nullable": true
          },
          "credentialType": {
            "type": "string",
            "nullable": true
          },
          "fingerIndex": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "deviceVendor": {
            "type": "string",
            "nullable": true
          },
          "syncStatus": {
            "type": "string",
            "nullable": true
          },
          "syncedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "syncError": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "deviceName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TimelineEventRow": {
        "type": "object",
        "properties": {
          "punchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "clockRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "source": {
            "type": "string",
            "nullable": true
          },
          "isManual": {
            "type": "boolean"
          },
          "deviceName": {
            "type": "string",
            "nullable": true
          },
          "credentialType": {
            "type": "string",
            "nullable": true
          },
          "photoStorageKey": {
            "type": "string",
            "nullable": true
          },
          "photoUrl": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfDailyClockRow": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DailyClockRow"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "DailyClockRow": {
        "type": "object",
        "properties": {
          "employeeId": {
            "type": "string",
            "format": "uuid"
          },
          "employeeCode": {
            "type": "string",
            "nullable": true
          },
          "employeeName": {
            "type": "string",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "firstIn": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastOut": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "scanCount": {
            "type": "integer",
            "format": "int32"
          },
          "manualEntryCount": {
            "type": "integer",
            "format": "int32"
          },
          "sources": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AttendanceDeviceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deviceName": {
            "type": "string",
            "nullable": true
          },
          "deviceSerial": {
            "type": "string",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "vendor": {
            "type": "string",
            "nullable": true
          },
          "protocol": {
            "type": "string",
            "nullable": true
          },
          "ipAddress": {
            "type": "string",
            "nullable": true
          },
          "port": {
            "type": "integer",
            "format": "int32"
          },
          "modelName": {
            "type": "string",
            "nullable": true
          },
          "isOnline": {
            "type": "boolean"
          },
          "isActive": {
            "type": "boolean"
          },
          "lastPingAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastEventAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "role": {
            "type": "string",
            "nullable": true
          },
          "supportsFace": {
            "type": "boolean"
          },
          "supportsFingerprint": {
            "type": "boolean"
          },
          "supportsCard": {
            "type": "boolean"
          },
          "supportsQr": {
            "type": "boolean"
          },
          "firmwareVersion": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "hikUsername": {
            "type": "string",
            "nullable": true
          },
          "authBlocked": {
            "type": "boolean"
          },
          "authBlockedReason": {
            "type": "string",
            "nullable": true
          },
          "faceUsed": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "faceMax": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "supportsCaptureFaceData": {
            "type": "boolean",
            "nullable": true
          },
          "lastPunchAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SenderProfileDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "fromName": {
            "type": "string",
            "nullable": true
          },
          "fromEmail": {
            "type": "string",
            "nullable": true
          },
          "replyTo": {
            "type": "string",
            "nullable": true
          },
          "isDefault": {
            "type": "boolean"
          },
          "isVerified": {
            "type": "boolean"
          },
          "verifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "dkimStatus": {
            "type": "string",
            "nullable": true
          },
          "spfStatus": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "brevoSenderId": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "domain": {
            "type": "string",
            "nullable": true
          },
          "isFreemailDomain": {
            "type": "boolean"
          },
          "dkimRecord": {
            "type": "string",
            "nullable": true
          },
          "dkimRecordHost": {
            "type": "string",
            "nullable": true
          },
          "spfRecord": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ReportOverviewDto": {
        "type": "object",
        "properties": {
          "period": {
            "$ref": "#/components/schemas/ReportPeriodDto"
          },
          "kpis": {
            "$ref": "#/components/schemas/ReportKpiDto"
          },
          "byDay": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportByDayDto"
            },
            "nullable": true
          },
          "byChannel": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportByChannelDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ReportByChannelDto": {
        "type": "object",
        "properties": {
          "channel": {
            "type": "string",
            "nullable": true
          },
          "sent": {
            "type": "integer",
            "format": "int64"
          },
          "openRate": {
            "type": "number",
            "format": "double"
          },
          "clickRate": {
            "type": "number",
            "format": "double"
          },
          "conversionRate": {
            "type": "number",
            "format": "double"
          },
          "delivered": {
            "type": "integer",
            "format": "int64"
          },
          "failed": {
            "type": "integer",
            "format": "int64"
          },
          "revenue": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "ReportByDayDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "nullable": true
          },
          "sent": {
            "type": "integer",
            "format": "int64"
          },
          "opens": {
            "type": "integer",
            "format": "int64"
          },
          "clicks": {
            "type": "integer",
            "format": "int64"
          },
          "conversions": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "ReportKpiDto": {
        "type": "object",
        "properties": {
          "totalSent": {
            "type": "integer",
            "format": "int64"
          },
          "deliveredRate": {
            "type": "number",
            "format": "double"
          },
          "openRate": {
            "type": "number",
            "format": "double"
          },
          "clickRate": {
            "type": "number",
            "format": "double"
          },
          "conversionRate": {
            "type": "number",
            "format": "double"
          },
          "revenue": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "ReportPeriodDto": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "nullable": true
          },
          "to": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GoogleIntegrationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "integrationType": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "googleAccountEmail": {
            "type": "string",
            "nullable": true
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "connectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "tokenExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastRefreshedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "selectedResourceId": {
            "type": "string",
            "nullable": true
          },
          "selectedResourceName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfEmailTemplateListDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailTemplateListDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "EmailTemplateListDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "type": "string",
            "nullable": true
          },
          "isSystem": {
            "type": "boolean"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "editorMode": {
            "type": "string",
            "nullable": true
          },
          "usedInCampaigns": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "EmailCampaignDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "subject": {
            "type": "string",
            "nullable": true
          },
          "previewText": {
            "type": "string",
            "nullable": true
          },
          "senderProfile": {
            "$ref": "#/components/schemas/SenderProfileSummaryDto"
          },
          "templateId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "audienceFilter": {
            "$ref": "#/components/schemas/AudienceFilterDto"
          },
          "abTestEnabled": {
            "type": "boolean"
          },
          "abSubjectVariant": {
            "type": "string",
            "nullable": true
          },
          "abSplitPct": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "recipientCount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "scheduledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "mergeTags": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          },
          "optimizeSendTime": {
            "type": "boolean"
          },
          "sent": {
            "type": "integer",
            "format": "int32"
          },
          "delivered": {
            "type": "integer",
            "format": "int32"
          },
          "opensUnique": {
            "type": "integer",
            "format": "int32"
          },
          "clicksUnique": {
            "type": "integer",
            "format": "int32"
          },
          "excludeRecentDays": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AudienceFilterDto": {
        "type": "object",
        "properties": {
          "logic": {
            "type": "string",
            "nullable": true
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FilterConditionDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FilterConditionDto": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "nullable": true
          },
          "operator": {
            "type": "string",
            "nullable": true
          },
          "value": {}
        },
        "additionalProperties": false
      },
      "SenderProfileSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "fromName": {
            "type": "string",
            "nullable": true
          },
          "fromEmail": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "EmailMergeVariableGroupDto": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string",
            "nullable": true
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "source": {
            "type": "string",
            "nullable": true
          },
          "variables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailMergeVariableDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "EmailMergeVariableDto": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "nullable": true
          },
          "key": {
            "type": "string",
            "nullable": true
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "example": {
            "type": "string",
            "nullable": true
          },
          "isAlias": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfEmailCampaignDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailCampaignDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PagedSubscriptionsResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentSubscriptionDto"
            },
            "nullable": true
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "PaymentSubscriptionDto": {
        "type": "object",
        "properties": {
          "subscriptionId": {
            "type": "string",
            "format": "uuid"
          },
          "referenceType": {
            "type": "string",
            "nullable": true
          },
          "referenceId": {
            "type": "string",
            "format": "uuid"
          },
          "payerType": {
            "type": "string",
            "nullable": true
          },
          "payerId": {
            "type": "string",
            "format": "uuid"
          },
          "providerCode": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "billingPeriod": {
            "type": "string",
            "nullable": true
          },
          "renewalModel": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "currentPeriodStart": {
            "type": "string",
            "format": "date-time"
          },
          "currentPeriodEnd": {
            "type": "string",
            "format": "date-time"
          },
          "nextBillingDate": {
            "type": "string",
            "format": "date-time"
          },
          "reminderDaysBefore": {
            "type": "integer",
            "format": "int32"
          },
          "gracePeriodDays": {
            "type": "integer",
            "format": "int32"
          },
          "reminderSentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "suspendedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cancelledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "PaymentOverviewDto": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "totalTransactions": {
            "type": "integer",
            "format": "int32"
          },
          "totalAmount": {
            "type": "integer",
            "format": "int64"
          },
          "totalNetAmount": {
            "type": "integer",
            "format": "int64"
          },
          "totalFees": {
            "type": "integer",
            "format": "int64"
          },
          "totalRefunds": {
            "type": "integer",
            "format": "int64"
          },
          "activeSubscriptions": {
            "type": "integer",
            "format": "int32"
          },
          "pendingRefunds": {
            "type": "integer",
            "format": "int32"
          },
          "byProvider": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProviderBreakdownDto"
            },
            "nullable": true
          },
          "byReferenceType": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReferenceTypeBreakdownDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ReferenceTypeBreakdownDto": {
        "type": "object",
        "properties": {
          "referenceType": {
            "type": "string",
            "nullable": true
          },
          "count": {
            "type": "integer",
            "format": "int32"
          },
          "totalAmount": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "ProviderBreakdownDto": {
        "type": "object",
        "properties": {
          "providerCode": {
            "type": "string",
            "nullable": true
          },
          "transactionCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalAmount": {
            "type": "integer",
            "format": "int64"
          },
          "successRate": {
            "type": "number",
            "format": "double"
          },
          "avgFeeRate": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "PagedRefundsResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentRefundDto"
            },
            "nullable": true
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "PaymentRefundDto": {
        "type": "object",
        "properties": {
          "refundId": {
            "type": "string",
            "format": "uuid"
          },
          "transactionId": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "refundMethod": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "requestedBy": {
            "type": "string",
            "format": "uuid"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "approvedBy": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "approvedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "rejectedBy": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "rejectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "rejectionReason": {
            "type": "string",
            "nullable": true
          },
          "processedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "providerRefundId": {
            "type": "string",
            "nullable": true
          },
          "bankTransactionRef": {
            "type": "string",
            "nullable": true
          },
          "providerCode": {
            "type": "string",
            "nullable": true
          },
          "transactionAmount": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "referenceType": {
            "type": "string",
            "nullable": true
          },
          "referenceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "providerTransactionId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PaymentTransactionDetailDto": {
        "type": "object",
        "properties": {
          "transactionId": {
            "type": "string",
            "format": "uuid"
          },
          "intentId": {
            "type": "string",
            "format": "uuid"
          },
          "providerCode": {
            "type": "string",
            "nullable": true
          },
          "providerTransactionId": {
            "type": "string",
            "nullable": true
          },
          "referenceType": {
            "type": "string",
            "nullable": true
          },
          "referenceId": {
            "type": "string",
            "format": "uuid"
          },
          "payerType": {
            "type": "string",
            "nullable": true
          },
          "payerId": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "netAmount": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "paidAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "GetPaymentTransactionsResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentTransactionDto"
            },
            "nullable": true
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "totalRecords": {
            "type": "integer",
            "format": "int32"
          },
          "totalAmount": {
            "type": "integer",
            "format": "int64"
          },
          "totalNetAmount": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "PaymentTransactionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "intentId": {
            "type": "string",
            "format": "uuid"
          },
          "providerCode": {
            "type": "string",
            "nullable": true
          },
          "referenceType": {
            "type": "string",
            "nullable": true
          },
          "referenceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "netAmount": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "providerTransactionId": {
            "type": "string",
            "nullable": true
          },
          "paidAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "providerApprovalCode": {
            "type": "string",
            "nullable": true
          },
          "paymentInstrument": {
            "type": "string",
            "nullable": true
          },
          "paymentInstrumentDetail": {
            "type": "string",
            "nullable": true
          },
          "refundedAmount": {
            "type": "integer",
            "format": "int64"
          },
          "refundCount": {
            "type": "integer",
            "format": "int32"
          },
          "latestRefundStatus": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PaymentIntentDto": {
        "type": "object",
        "properties": {
          "intentId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "providerCode": {
            "type": "string",
            "nullable": true
          },
          "paymentUrl": {
            "type": "string",
            "nullable": true
          },
          "qrCodeData": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "referenceType": {
            "type": "string",
            "nullable": true
          },
          "referenceId": {
            "type": "string",
            "format": "uuid"
          },
          "payerType": {
            "type": "string",
            "nullable": true
          },
          "payerId": {
            "type": "string",
            "format": "uuid"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "transactionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "CompletedIntentDto": {
        "type": "object",
        "properties": {
          "paymentIntentId": {
            "type": "string",
            "format": "uuid"
          },
          "workspaceId": {
            "type": "string",
            "format": "uuid"
          },
          "payerType": {
            "type": "string",
            "nullable": true
          },
          "payerId": {
            "type": "string",
            "format": "uuid"
          },
          "referenceType": {
            "type": "string",
            "nullable": true
          },
          "referenceId": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "netAmount": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "providerCode": {
            "type": "string",
            "nullable": true
          },
          "providerTransactionId": {
            "type": "string",
            "nullable": true
          },
          "paidAt": {
            "type": "string",
            "format": "date-time"
          },
          "dbTransactionId": {
            "type": "string",
            "format": "uuid"
          },
          "providerApprovalCode": {
            "type": "string",
            "nullable": true
          },
          "paymentInstrument": {
            "type": "string",
            "nullable": true
          },
          "paymentInstrumentDetail": {
            "type": "string",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          },
          "recurringContractNo": {
            "type": "string",
            "nullable": true
          },
          "recurringPeriodNum": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BarcodeProductDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "imageUrl": {
            "type": "string",
            "nullable": true
          },
          "trackingType": {
            "type": "string",
            "nullable": true
          },
          "sellingPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "stockQuantity": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "nullable": true
          },
          "taxRate": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "unitCode": {
            "type": "string",
            "nullable": true
          },
          "matchedUnitCode": {
            "type": "string",
            "nullable": true
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "skuId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "variantName": {
            "type": "string",
            "nullable": true
          },
          "variantIsActive": {
            "type": "boolean",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "StockForecastDto": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "productCode": {
            "type": "string",
            "nullable": true
          },
          "productName": {
            "type": "string",
            "nullable": true
          },
          "imageUrl": {
            "type": "string",
            "nullable": true
          },
          "currentStock": {
            "type": "number",
            "format": "double"
          },
          "avgDailySales": {
            "type": "number",
            "format": "double"
          },
          "daysUntilStockout": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "stockStatus": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "KitAvailabilityDto": {
        "type": "object",
        "properties": {
          "kitSkuId": {
            "type": "string",
            "format": "uuid"
          },
          "availableSets": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "componentCount": {
            "type": "integer",
            "format": "int32"
          },
          "limitingComponentSkuId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "limitingComponentName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfUnknownLotReportDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UnknownLotReportDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "UnknownLotReportDto": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "productCode": {
            "type": "string",
            "nullable": true
          },
          "productName": {
            "type": "string",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "remainingQuantity": {
            "type": "number",
            "format": "double"
          },
          "soldQuantity": {
            "type": "number",
            "format": "double"
          },
          "lastSoldAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "categoryId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "categoryName": {
            "type": "string",
            "nullable": true
          },
          "skuCode": {
            "type": "string",
            "nullable": true
          },
          "sellingPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "purchasePrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfLotExpiryReportDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LotExpiryReportDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "LotExpiryReportDto": {
        "type": "object",
        "properties": {
          "lotId": {
            "type": "string",
            "format": "uuid"
          },
          "productName": {
            "type": "string",
            "nullable": true
          },
          "productCode": {
            "type": "string",
            "nullable": true
          },
          "lotNumber": {
            "type": "string",
            "nullable": true
          },
          "expiryDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "daysToExpiry": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "availableQuantity": {
            "type": "number",
            "format": "double"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "totalValue": {
            "type": "integer",
            "format": "int64"
          },
          "categoryId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "categoryName": {
            "type": "string",
            "nullable": true
          },
          "skuCode": {
            "type": "string",
            "nullable": true
          },
          "sellingPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "purchasePrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "variantName": {
            "type": "string",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProductBranchStockDto": {
        "type": "object",
        "properties": {
          "branchId": {
            "type": "string",
            "format": "uuid"
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "onHand": {
            "type": "number",
            "format": "double"
          },
          "reserved": {
            "type": "number",
            "format": "double"
          },
          "available": {
            "type": "number",
            "format": "double"
          },
          "sold": {
            "type": "number",
            "format": "double"
          },
          "incoming": {
            "type": "number",
            "format": "double"
          },
          "daysUntilStockout": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "estimatedStockoutDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProductDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "productType": {
            "type": "string",
            "nullable": true
          },
          "trackingType": {
            "type": "string",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "$ref": "#/components/schemas/CategoryRefDto"
          },
          "brand": {
            "$ref": "#/components/schemas/BrandRefDto"
          },
          "unit": {
            "$ref": "#/components/schemas/UnitRefDto"
          },
          "currentPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "currentCost": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "wholesalePrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "taxRate": {
            "type": "number",
            "format": "double"
          },
          "sellPriceIncludesVat": {
            "type": "boolean"
          },
          "stockQuantity": {
            "type": "number",
            "format": "double"
          },
          "warrantyMonths": {
            "type": "integer",
            "format": "int32"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "imageKey": {
            "type": "string",
            "nullable": true
          },
          "imageUrl": {
            "type": "string",
            "nullable": true
          },
          "imageKeys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "imageUrls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "variantCount": {
            "type": "integer",
            "format": "int32"
          },
          "attributes": {
            "type": "string",
            "nullable": true
          },
          "minPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "maxPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "defaultSkuId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "isLotTracked": {
            "type": "boolean"
          },
          "isSerialTracked": {
            "type": "boolean"
          },
          "isSoldDirectly": {
            "type": "boolean"
          },
          "isDeleteProtected": {
            "type": "boolean"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "kitPriceMode": {
            "enum": [
              "AutoCalculate",
              "Override"
            ],
            "type": "string"
          },
          "kitPriceOverride": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "stockByBranch": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductBranchStockDetailDto"
            },
            "nullable": true
          },
          "minStockLevel": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "maxStockLevel": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "weight": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "weightUnit": {
            "type": "string",
            "nullable": true
          },
          "lengthCm": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "widthCm": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "heightCm": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "locations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LocationRefDto"
            },
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "customFields": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LocationRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "code": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProductBranchStockDetailDto": {
        "type": "object",
        "properties": {
          "branchId": {
            "type": "string",
            "format": "uuid"
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "onHand": {
            "type": "number",
            "format": "double"
          },
          "reserved": {
            "type": "number",
            "format": "double"
          },
          "available": {
            "type": "number",
            "format": "double"
          },
          "avgCost": {
            "type": "number",
            "format": "double"
          },
          "incoming": {
            "type": "number",
            "format": "double"
          },
          "daysUntilStockout": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "estimatedStockoutDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "allowSale": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "UnitRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BrandRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "code": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CategoryRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfDeletedProductDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeletedProductDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "DeletedProductDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "productType": {
            "type": "string",
            "nullable": true
          },
          "trackingType": {
            "type": "string",
            "nullable": true
          },
          "categoryName": {
            "type": "string",
            "nullable": true
          },
          "unitName": {
            "type": "string",
            "nullable": true
          },
          "sellingPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "costPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "imageUrl": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deletedBy": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProductListResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductListDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          },
          "summary": {
            "$ref": "#/components/schemas/ProductListSummaryDto"
          }
        },
        "additionalProperties": false
      },
      "ProductListSummaryDto": {
        "type": "object",
        "properties": {
          "totalStock": {
            "type": "number",
            "format": "double"
          },
          "totalReserved": {
            "type": "number",
            "format": "double"
          },
          "totalStockValueCost": {
            "type": "number",
            "format": "double"
          },
          "totalStockValuePrice": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "ProductListDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "productType": {
            "type": "string",
            "nullable": true
          },
          "trackingType": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "$ref": "#/components/schemas/CategoryRefDto"
          },
          "unit": {
            "$ref": "#/components/schemas/UnitRefDto"
          },
          "currentPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "currentCost": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "wholesalePrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "minPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "maxPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "stockQuantity": {
            "type": "number",
            "format": "double"
          },
          "openingStock": {
            "type": "number",
            "format": "double"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "imageKey": {
            "type": "string",
            "nullable": true
          },
          "imageUrl": {
            "type": "string",
            "nullable": true
          },
          "warrantyMonths": {
            "type": "integer",
            "format": "int32"
          },
          "variantCount": {
            "type": "integer",
            "format": "int32"
          },
          "attributes": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "unitConversions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductUnitConversionDto"
            },
            "nullable": true
          },
          "isLotTracked": {
            "type": "boolean"
          },
          "isSerialTracked": {
            "type": "boolean"
          },
          "taxRate": {
            "type": "number",
            "format": "double"
          },
          "sellPriceIncludesVat": {
            "type": "boolean"
          },
          "defaultSkuId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "nullable": true
          },
          "customFields": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "brandId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "brandName": {
            "type": "string",
            "nullable": true
          },
          "minStockLevel": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "maxStockLevel": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "reserved": {
            "type": "number",
            "format": "double"
          },
          "location": {
            "type": "string",
            "nullable": true
          },
          "weight": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "weightUnit": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "source": {
            "type": "string",
            "nullable": true
          },
          "sourceRef": {
            "type": "string",
            "nullable": true
          },
          "packageKind": {
            "type": "string",
            "nullable": true
          },
          "durationMonths": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "packageServicesJson": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProductUnitConversionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "unitId": {
            "type": "string",
            "format": "uuid"
          },
          "unitCode": {
            "type": "string",
            "nullable": true
          },
          "unitName": {
            "type": "string",
            "nullable": true
          },
          "conversionToBase": {
            "type": "number",
            "format": "double"
          },
          "isBase": {
            "type": "boolean"
          },
          "isActive": {
            "type": "boolean"
          },
          "sellingPrice": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProductStatsDto": {
        "type": "object",
        "properties": {
          "totalProducts": {
            "type": "integer",
            "format": "int32"
          },
          "activeProducts": {
            "type": "integer",
            "format": "int32"
          },
          "variantProducts": {
            "type": "integer",
            "format": "int32"
          },
          "lowStockProducts": {
            "type": "integer",
            "format": "int32"
          },
          "totalQuantity": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "OrderDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "orderType": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "salesCustomerId": {
            "type": "string",
            "format": "uuid"
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "contactPhone": {
            "type": "string",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid"
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "subtotal": {
            "type": "number",
            "format": "double"
          },
          "shippingFee": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "paidAmount": {
            "type": "number",
            "format": "double"
          },
          "debtAmount": {
            "type": "number",
            "format": "double"
          },
          "paymentMethod": {
            "type": "string",
            "nullable": true
          },
          "cashAccountId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "shipmentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItemDto"
            },
            "nullable": true
          },
          "confirmedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cancelledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cancelReason": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "assignedTo": {
            "$ref": "#/components/schemas/UserRefDto"
          },
          "assignees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderAssigneeDto"
            },
            "nullable": true
          },
          "createdBy": {
            "$ref": "#/components/schemas/UserRefDto"
          },
          "discount": {
            "$ref": "#/components/schemas/OrderDiscountDto"
          },
          "vat": {
            "$ref": "#/components/schemas/OrderVatDto"
          },
          "paymentStatus": {
            "type": "string",
            "nullable": true
          },
          "couponCode": {
            "type": "string",
            "nullable": true
          },
          "delivery": {
            "$ref": "#/components/schemas/DeliveryAddressDto"
          },
          "codAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "channelCode": {
            "type": "string",
            "nullable": true
          },
          "externalOrderId": {
            "type": "string",
            "nullable": true
          },
          "orderDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "sourceOrderIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "nullable": true
          },
          "convertedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "returns": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderReturnSummaryDto"
            },
            "nullable": true
          },
          "pointsUsed": {
            "type": "integer",
            "format": "int32"
          },
          "pointsDiscount": {
            "type": "number",
            "format": "double"
          },
          "voucherCodes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "depositAmount": {
            "type": "number",
            "format": "double"
          },
          "depositPaymentMethod": {
            "type": "string",
            "nullable": true
          },
          "depositDeducted": {
            "type": "number",
            "format": "double"
          },
          "expectedDeliveryDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "promotionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "paymentBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentRowDto"
            },
            "nullable": true
          },
          "bankAccountId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customerCode": {
            "type": "string",
            "nullable": true
          },
          "customerAddress": {
            "type": "string",
            "nullable": true
          },
          "customerTaxCode": {
            "type": "string",
            "nullable": true
          },
          "priceListIdOverride": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourcePreOrderId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourcePreOrderCode": {
            "type": "string",
            "nullable": true
          },
          "customerCurrentDebt": {
            "type": "number",
            "format": "double"
          },
          "customFields": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          },
          "approvedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "approvedBy": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "childOrders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PreOrderChildOrderDto"
            },
            "nullable": true
          },
          "internalNotes": {
            "type": "string",
            "nullable": true
          },
          "otherCharges": {
            "type": "number",
            "format": "double"
          },
          "outletId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "deliveryEmployee": {
            "$ref": "#/components/schemas/UserRefDto"
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "idempotentReplay": {
            "type": "boolean"
          },
          "shippingPlan": {
            "$ref": "#/components/schemas/OrderShippingPlanDto"
          },
          "discountAmount": {
            "type": "number",
            "format": "double",
            "readOnly": true
          },
          "taxAmount": {
            "type": "number",
            "format": "double",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "OrderShippingPlanDto": {
        "type": "object",
        "properties": {
          "carrierCode": {
            "type": "string",
            "nullable": true
          },
          "carrierConfigId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "serviceType": {
            "type": "string",
            "nullable": true
          },
          "weightGrams": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "lengthCm": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "widthCm": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "heightCm": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "carrierOptions": {
            "nullable": true
          },
          "estimatedFee": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "freeshipCode": {
            "type": "string",
            "nullable": true
          },
          "note": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PreOrderChildOrderDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "orderDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "paidAmount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "PaymentRowDto": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "OrderReturnSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "returnCode": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "returnType": {
            "type": "string",
            "nullable": true
          },
          "refundAmount": {
            "type": "number",
            "format": "double"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "exchangeNewOrderId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DeliveryAddressDto": {
        "type": "object",
        "properties": {
          "customerAddressId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "addressLine": {
            "type": "string",
            "nullable": true
          },
          "province": {
            "type": "string",
            "nullable": true
          },
          "provinceCode": {
            "type": "string",
            "nullable": true
          },
          "district": {
            "type": "string",
            "nullable": true
          },
          "districtCode": {
            "type": "string",
            "nullable": true
          },
          "ward": {
            "type": "string",
            "nullable": true
          },
          "wardCode": {
            "type": "string",
            "nullable": true
          },
          "latitude": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "longitude": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OrderVatDto": {
        "type": "object",
        "properties": {
          "percent": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "included": {
            "type": "boolean"
          },
          "mode": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "OrderDiscountDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "OrderAssigneeDto": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "commissionPercent": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "UserRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OrderItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "productName": {
            "type": "string",
            "nullable": true
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "variantName": {
            "type": "string",
            "nullable": true
          },
          "unitCode": {
            "type": "string",
            "nullable": true
          },
          "unitName": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "format": "double"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "subtotal": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "discount": {
            "$ref": "#/components/schemas/OrderItemDiscountDto"
          },
          "tax": {
            "$ref": "#/components/schemas/OrderItemTaxDto"
          },
          "tracking": {
            "$ref": "#/components/schemas/OrderItemTrackingDto"
          },
          "variantCode": {
            "type": "string",
            "nullable": true
          },
          "fulfilledQuantity": {
            "type": "number",
            "format": "double"
          },
          "unfulfilledQuantity": {
            "type": "number",
            "format": "double"
          },
          "convertedQty": {
            "type": "number",
            "format": "double"
          },
          "remainingConvertQty": {
            "type": "number",
            "format": "double"
          },
          "productType": {
            "type": "string",
            "nullable": true
          },
          "returnedQuantity": {
            "type": "number",
            "format": "double"
          },
          "itemNote": {
            "type": "string",
            "nullable": true
          },
          "isGift": {
            "type": "boolean"
          },
          "productGroup": {
            "type": "string",
            "nullable": true
          },
          "weight": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "weightUnit": {
            "type": "string",
            "nullable": true
          },
          "productItemCode": {
            "type": "string",
            "nullable": true
          },
          "skuCode": {
            "type": "string",
            "nullable": true
          },
          "openReturnQuantity": {
            "type": "number",
            "format": "double"
          },
          "openReturnCodes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "kitComponents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItemComponentDto"
            },
            "nullable": true
          },
          "skuId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "lots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItemReturnLotDto"
            },
            "nullable": true
          },
          "priceIncludesVat": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "OrderItemReturnLotDto": {
        "type": "object",
        "properties": {
          "lotId": {
            "type": "string",
            "format": "uuid"
          },
          "lotNumber": {
            "type": "string",
            "nullable": true
          },
          "expiryDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "format": "double"
          },
          "returnedQuantity": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "OrderItemComponentDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "componentSkuId": {
            "type": "string",
            "format": "uuid"
          },
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "productName": {
            "type": "string",
            "nullable": true
          },
          "variantName": {
            "type": "string",
            "nullable": true
          },
          "skuCode": {
            "type": "string",
            "nullable": true
          },
          "trackingType": {
            "type": "string",
            "nullable": true
          },
          "unitCode": {
            "type": "string",
            "nullable": true
          },
          "quantityPerSet": {
            "type": "number",
            "format": "double"
          },
          "quantity": {
            "type": "number",
            "format": "double"
          },
          "allocatedAmount": {
            "type": "number",
            "format": "double"
          },
          "refundPerUnit": {
            "type": "number",
            "format": "double"
          },
          "returnedQuantity": {
            "type": "number",
            "format": "double"
          },
          "returnableQuantity": {
            "type": "number",
            "format": "double"
          },
          "serialNumbers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OrderItemTrackingDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "lotId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "lotNumber": {
            "type": "string",
            "nullable": true
          },
          "imeiSerial": {
            "type": "string",
            "nullable": true
          },
          "imeiSerials": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OrderItemTaxDto": {
        "type": "object",
        "properties": {
          "rate": {
            "type": "number",
            "format": "double"
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "OrderItemDiscountDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "rate": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "OrderListResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderListDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          },
          "summary": {
            "$ref": "#/components/schemas/OrderListSummaryDto"
          },
          "paymentMethodsPresent": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OrderListSummaryDto": {
        "type": "object",
        "properties": {
          "subtotal": {
            "type": "number",
            "format": "double"
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "totalAmount": {
            "type": "number",
            "format": "double"
          },
          "totalPaid": {
            "type": "number",
            "format": "double"
          },
          "totalDebt": {
            "type": "number",
            "format": "double"
          },
          "totalQuantity": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "OrderListDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "orderType": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "salesCustomerId": {
            "type": "string",
            "format": "uuid"
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "contactPhone": {
            "type": "string",
            "nullable": true
          },
          "customerCode": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid"
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "subtotal": {
            "type": "number",
            "format": "double"
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "shippingFee": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "paidAmount": {
            "type": "number",
            "format": "double"
          },
          "debtAmount": {
            "type": "number",
            "format": "double"
          },
          "debtStatus": {
            "type": "string",
            "nullable": true
          },
          "paymentMethod": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "vatMode": {
            "type": "string",
            "nullable": true
          },
          "confirmedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cancelledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cancelReason": {
            "type": "string",
            "nullable": true
          },
          "itemCount": {
            "type": "integer",
            "format": "int32"
          },
          "assignedTo": {
            "$ref": "#/components/schemas/UserRefDto"
          },
          "assignees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderAssigneeDto"
            },
            "nullable": true
          },
          "unitCode": {
            "type": "string",
            "nullable": true
          },
          "unitName": {
            "type": "string",
            "nullable": true
          },
          "paymentBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentRowDto"
            },
            "nullable": true
          },
          "returnStatus": {
            "type": "string",
            "nullable": true
          },
          "hasOpenReturn": {
            "type": "boolean"
          },
          "channelCode": {
            "type": "string",
            "nullable": true
          },
          "orderDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "eInvoiceStatus": {
            "type": "string",
            "nullable": true
          },
          "eInvoiceNumber": {
            "type": "string",
            "nullable": true
          },
          "vatExportedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "outletId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "deliveryEmployee": {
            "$ref": "#/components/schemas/UserRefDto"
          },
          "expectedDeliveryDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "depositAmount": {
            "type": "number",
            "format": "double"
          },
          "deliveryStatus": {
            "type": "string",
            "nullable": true
          },
          "internalNotes": {
            "type": "string",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastPaymentDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderPaymentEntryDto"
            },
            "nullable": true
          },
          "deliveryAddress": {
            "type": "string",
            "nullable": true
          },
          "deliveryName": {
            "type": "string",
            "nullable": true
          },
          "deliveryPhone": {
            "type": "string",
            "nullable": true
          },
          "customerInfo": {
            "$ref": "#/components/schemas/OrderListCustomerInfoDto"
          },
          "outletInfo": {
            "$ref": "#/components/schemas/OrderListOutletInfoDto"
          }
        },
        "additionalProperties": false
      },
      "OrderListOutletInfoDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "ownerName": {
            "type": "string",
            "nullable": true
          },
          "ownerPhone": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "channelCode": {
            "type": "string",
            "nullable": true
          },
          "tier": {
            "type": "string",
            "nullable": true
          },
          "repNames": {
            "type": "string",
            "nullable": true
          },
          "routeNames": {
            "type": "string",
            "nullable": true
          },
          "taxCode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OrderListCustomerInfoDto": {
        "type": "object",
        "properties": {
          "groupName": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "taxCode": {
            "type": "string",
            "nullable": true
          },
          "netDebt": {
            "type": "number",
            "format": "double"
          },
          "ownerName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OrderPaymentEntryDto": {
        "type": "object",
        "properties": {
          "receiptId": {
            "type": "string",
            "format": "uuid"
          },
          "receiptCode": {
            "type": "string",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "paymentMethod": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "ExportOrdersResult": {
        "type": "object",
        "properties": {
          "jobId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "additionalProperties": false
      },
      "OrderStatsDto": {
        "type": "object",
        "properties": {
          "pending": {
            "type": "integer",
            "format": "int32"
          },
          "processing": {
            "type": "integer",
            "format": "int32"
          },
          "completed": {
            "type": "integer",
            "format": "int32"
          },
          "cancelled": {
            "type": "integer",
            "format": "int32"
          },
          "totalAmount": {
            "type": "number",
            "format": "double"
          },
          "paidAmount": {
            "type": "number",
            "format": "double"
          },
          "debtAmount": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "CustomerListResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerListDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          },
          "summary": {
            "$ref": "#/components/schemas/CustomerListSummaryDto"
          }
        },
        "additionalProperties": false
      },
      "CustomerListSummaryDto": {
        "type": "object",
        "properties": {
          "totalDebt": {
            "type": "number",
            "format": "double"
          },
          "totalRevenue": {
            "type": "number",
            "format": "double"
          },
          "totalPurchase": {
            "type": "number",
            "format": "double"
          },
          "totalDebtLimit": {
            "type": "number",
            "format": "double"
          },
          "totalOrders": {
            "type": "integer",
            "format": "int64"
          },
          "totalPoints": {
            "type": "integer",
            "format": "int64"
          },
          "totalAdvance": {
            "type": "number",
            "format": "double"
          },
          "netDebt": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "CustomerListDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "customerCode": {
            "type": "string",
            "nullable": true
          },
          "crmContactId": {
            "type": "string",
            "format": "uuid"
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "customerType": {
            "type": "string",
            "nullable": true
          },
          "customerGroupId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customerGroupName": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "totalDebt": {
            "type": "number",
            "format": "double"
          },
          "debtLimit": {
            "type": "number",
            "format": "double"
          },
          "totalOrders": {
            "type": "integer",
            "format": "int32"
          },
          "totalRevenue": {
            "type": "number",
            "format": "double"
          },
          "totalPurchase": {
            "type": "number",
            "format": "double"
          },
          "lastOrderAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "avatarKey": {
            "type": "string",
            "nullable": true
          },
          "avatarUrl": {
            "type": "string",
            "nullable": true
          },
          "priceListIdOverride": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "totalPoints": {
            "type": "integer",
            "format": "int32"
          },
          "gymMemberCode": {
            "type": "string",
            "nullable": true
          },
          "assignedTo": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "assignedToName": {
            "type": "string",
            "nullable": true
          },
          "customFields": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "debtDays": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "linkedSupplierId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "advanceRemaining": {
            "type": "number",
            "format": "double"
          },
          "netDebt": {
            "type": "number",
            "format": "double"
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TaskDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "priority": {
            "type": "string",
            "nullable": true
          },
          "startDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "dueDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "assigneeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "assigneeName": {
            "type": "string",
            "nullable": true
          },
          "contactId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "contactCode": {
            "type": "string",
            "nullable": true
          },
          "opportunityId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "opportunityName": {
            "type": "string",
            "nullable": true
          },
          "opportunityCode": {
            "type": "string",
            "nullable": true
          },
          "ticketId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "ticketSubject": {
            "type": "string",
            "nullable": true
          },
          "parentTaskId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "parentTaskTitle": {
            "type": "string",
            "nullable": true
          },
          "parentTaskCode": {
            "type": "string",
            "nullable": true
          },
          "progress": {
            "type": "integer",
            "format": "int32"
          },
          "customFields": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "remindAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reminderSentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateTaskRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "priority": {
            "type": "string",
            "nullable": true
          },
          "startDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "dueDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "assigneeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "contactId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "opportunityId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "ticketId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "parentTaskId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customFields": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          },
          "remindAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "StaleOpportunitiesDto": {
        "type": "object",
        "properties": {
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalEstimatedValue": {
            "type": "number",
            "format": "double"
          },
          "oldestExpectedCloseDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StaleOpportunityItemDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "StaleOpportunityItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "estimatedValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "expectedCloseDate": {
            "type": "string",
            "format": "date"
          },
          "daysOverdue": {
            "type": "integer",
            "format": "int32"
          },
          "assigneeId": {
            "type": "string",
            "format": "uuid"
          },
          "lastUpdatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MoveOpportunityStageRequest": {
        "type": "object",
        "properties": {
          "pipelineStageId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "additionalProperties": false
      },
      "PipelineStageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "orderIndex": {
            "type": "integer",
            "format": "int32"
          },
          "conversionRate": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OpportunityDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "contactId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "leadName": {
            "type": "string",
            "nullable": true
          },
          "pipelineStageId": {
            "type": "string",
            "format": "uuid"
          },
          "pipelineStageName": {
            "type": "string",
            "nullable": true
          },
          "pipelineStageColor": {
            "type": "string",
            "nullable": true
          },
          "estimatedValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "probability": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "expectedCloseDate": {
            "type": "string",
            "format": "date"
          },
          "assigneeId": {
            "type": "string",
            "format": "uuid"
          },
          "assigneeName": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "customFields": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "wonReason": {
            "type": "string",
            "nullable": true
          },
          "lostReason": {
            "type": "string",
            "nullable": true
          },
          "lostToCompetitor": {
            "type": "string",
            "nullable": true
          },
          "actualValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "actualCloseDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "wonAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "reopenCount": {
            "type": "integer",
            "format": "int32"
          },
          "lastReopenReason": {
            "type": "string",
            "nullable": true
          },
          "reopenedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OpportunityForecastStripDto": {
        "type": "object",
        "properties": {
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "openCount": {
            "type": "integer",
            "format": "int32"
          },
          "overdueCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalEstimatedValue": {
            "type": "number",
            "format": "double"
          },
          "weightedValue": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "OpportunityStatsDto": {
        "type": "object",
        "properties": {
          "totalOpen": {
            "type": "integer",
            "format": "int32"
          },
          "totalWon": {
            "type": "integer",
            "format": "int32"
          },
          "totalLost": {
            "type": "integer",
            "format": "int32"
          },
          "totalEstimatedValue": {
            "type": "number",
            "format": "double"
          },
          "totalWonValue": {
            "type": "number",
            "format": "double"
          },
          "newInPeriod": {
            "type": "integer",
            "format": "int32"
          },
          "winRate": {
            "type": "number",
            "format": "double"
          },
          "forecast": {
            "$ref": "#/components/schemas/OpportunityForecastDto"
          },
          "pipelineDistribution": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PipelineStageDistributionDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PipelineStageDistributionDto": {
        "type": "object",
        "properties": {
          "stageId": {
            "type": "string",
            "format": "uuid"
          },
          "stageName": {
            "type": "string",
            "nullable": true
          },
          "stageColor": {
            "type": "string",
            "nullable": true
          },
          "count": {
            "type": "integer",
            "format": "int32"
          },
          "totalValue": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "OpportunityForecastDto": {
        "type": "object",
        "properties": {
          "weightedValue": {
            "type": "number",
            "format": "double"
          },
          "openCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalOpenEstimatedValue": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfOpportunitySummaryDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OpportunitySummaryDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "OpportunitySummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "contactId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "contactCompanyName": {
            "type": "string",
            "nullable": true
          },
          "pipelineStageId": {
            "type": "string",
            "format": "uuid"
          },
          "pipelineStageName": {
            "type": "string",
            "nullable": true
          },
          "pipelineStageColor": {
            "type": "string",
            "nullable": true
          },
          "estimatedValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "probability": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "expectedCloseDate": {
            "type": "string",
            "format": "date"
          },
          "assigneeId": {
            "type": "string",
            "format": "uuid"
          },
          "assigneeName": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "wonReason": {
            "type": "string",
            "nullable": true
          },
          "lostReason": {
            "type": "string",
            "nullable": true
          },
          "lostToCompetitor": {
            "type": "string",
            "nullable": true
          },
          "wonAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "isOverdue": {
            "type": "boolean"
          },
          "daysOverdue": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "quotationCount": {
            "type": "integer",
            "format": "int32"
          },
          "contractCount": {
            "type": "integer",
            "format": "int32"
          },
          "latestCommentText": {
            "type": "string",
            "nullable": true
          },
          "latestCommentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reopenCount": {
            "type": "integer",
            "format": "int32"
          },
          "contactPhone": {
            "type": "string",
            "nullable": true
          },
          "campaignName": {
            "type": "string",
            "nullable": true
          },
          "nextCallAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "callCount": {
            "type": "integer",
            "format": "int32"
          },
          "lastDisposition": {
            "type": "string",
            "nullable": true
          },
          "lastCalledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OpportunityTagDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OpportunityTagDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ContactListStatsDto": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int32"
          },
          "withCustomerProfile": {
            "type": "integer",
            "format": "int32"
          },
          "byTier": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int32"
            },
            "nullable": true
          },
          "byLifecycleStage": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int32"
            },
            "nullable": true
          },
          "byContactStatus": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int32"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ContactBranchLookupDto": {
        "type": "object",
        "properties": {
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "lifecycleStage": {
            "type": "string",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "assigneeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "assigneeName": {
            "type": "string",
            "nullable": true
          },
          "visibleToYou": {
            "type": "boolean"
          },
          "canClaim": {
            "type": "boolean"
          },
          "canTransfer": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "BranchDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "parentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfContactSummaryDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactSummaryDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "ContactSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "contactType": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "jobTitle": {
            "type": "string",
            "nullable": true
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "avatarUrl": {
            "type": "string",
            "nullable": true
          },
          "tier": {
            "type": "string",
            "nullable": true
          },
          "hasCustomerProfile": {
            "type": "boolean"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagDto"
            },
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lifecycleStage": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "ward": {
            "type": "string",
            "nullable": true
          },
          "assigneeName": {
            "type": "string",
            "nullable": true
          },
          "assigneeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "pipelineStageName": {
            "type": "string",
            "nullable": true
          },
          "pipelineStageColor": {
            "type": "string",
            "nullable": true
          },
          "orderCount": {
            "type": "integer",
            "format": "int32"
          },
          "dealCount": {
            "type": "integer",
            "format": "int32"
          },
          "topDealValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "topDealStage": {
            "type": "string",
            "nullable": true
          },
          "topDealStageColor": {
            "type": "string",
            "nullable": true
          },
          "topDealCloseDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "topDealId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "provinceCode": {
            "type": "string",
            "nullable": true
          },
          "customerStatus": {
            "type": "string",
            "nullable": true
          },
          "groupName": {
            "type": "string",
            "nullable": true
          },
          "lastActivityAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "groupIcon": {
            "type": "string",
            "nullable": true
          },
          "groupColor": {
            "type": "string",
            "nullable": true
          },
          "statusLabel": {
            "type": "string",
            "nullable": true
          },
          "statusIcon": {
            "type": "string",
            "nullable": true
          },
          "statusColor": {
            "type": "string",
            "nullable": true
          },
          "customFields": {
            "type": "object",
            "additionalProperties": {
              "nullable": true
            },
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "assignedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "leadScore": {
            "type": "integer",
            "format": "int32"
          },
          "leadTier": {
            "type": "string",
            "nullable": true
          },
          "latestCommentText": {
            "type": "string",
            "nullable": true
          },
          "latestCommentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "sourceName": {
            "type": "string",
            "nullable": true
          },
          "phone2": {
            "type": "string",
            "nullable": true
          },
          "phone3": {
            "type": "string",
            "nullable": true
          },
          "dob": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "channelOrigin": {
            "$ref": "#/components/schemas/ContactChannelOriginDto"
          },
          "chatSummary": {
            "$ref": "#/components/schemas/ContactChatSummaryDto"
          },
          "nextActivityAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "nextActivityKind": {
            "type": "string",
            "nullable": true
          },
          "nextActivityTitle": {
            "type": "string",
            "nullable": true
          },
          "contactStatusId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "slaStage": {
            "type": "integer",
            "format": "int32"
          },
          "slaContactedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ContactChatSummaryDto": {
        "type": "object",
        "properties": {
          "openCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "unreadCount": {
            "type": "integer",
            "format": "int32"
          },
          "lastMessageAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastMessagePreview": {
            "type": "string",
            "nullable": true
          },
          "lastMessageDirection": {
            "type": "string",
            "nullable": true
          },
          "lastChannelType": {
            "type": "string",
            "nullable": true
          },
          "awaitingReplyMinutes": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "slaBreached": {
            "type": "boolean"
          },
          "botHandling": {
            "type": "boolean"
          },
          "linkedOrderCodes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "conversationTags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ContactChannelOriginDto": {
        "type": "object",
        "properties": {
          "channelType": {
            "type": "string",
            "nullable": true
          },
          "channelAccountName": {
            "type": "string",
            "nullable": true
          },
          "otherAccountCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "TagDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ContactDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "contactType": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "jobTitle": {
            "type": "string",
            "nullable": true
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "website": {
            "type": "string",
            "nullable": true
          },
          "avatarUrl": {
            "type": "string",
            "nullable": true
          },
          "gender": {
            "type": "string",
            "nullable": true
          },
          "dob": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "identityNumber": {
            "type": "string",
            "nullable": true
          },
          "identityIssuedDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "identityIssuedPlace": {
            "type": "string",
            "nullable": true
          },
          "ward": {
            "type": "string",
            "nullable": true
          },
          "phone2": {
            "type": "string",
            "nullable": true
          },
          "phone3": {
            "type": "string",
            "nullable": true
          },
          "linkedinUrl": {
            "type": "string",
            "nullable": true
          },
          "tier": {
            "type": "string",
            "nullable": true
          },
          "isDecisionMaker": {
            "type": "boolean"
          },
          "customFields": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          },
          "sourceRef": {
            "type": "string",
            "nullable": true
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagDto"
            },
            "nullable": true
          },
          "customerProfile": {
            "$ref": "#/components/schemas/CustomerProfileDto"
          },
          "supplierInfo": {
            "$ref": "#/components/schemas/SupplierInfoRefDto"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "lifecycleStage": {
            "type": "string",
            "nullable": true
          },
          "industryId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customerGroupId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "contactPersonName": {
            "type": "string",
            "nullable": true
          },
          "contactPersonPhone": {
            "type": "string",
            "nullable": true
          },
          "contactPersonRelationship": {
            "type": "string",
            "nullable": true
          },
          "provinceCode": {
            "type": "string",
            "nullable": true
          },
          "districtCode": {
            "type": "string",
            "nullable": true
          },
          "wardCode": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "groupName": {
            "type": "string",
            "nullable": true
          },
          "groupIcon": {
            "type": "string",
            "nullable": true
          },
          "groupColor": {
            "type": "string",
            "nullable": true
          },
          "assigneeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "assigneeName": {
            "type": "string",
            "nullable": true
          },
          "assignedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "statusLabel": {
            "type": "string",
            "nullable": true
          },
          "statusIcon": {
            "type": "string",
            "nullable": true
          },
          "statusColor": {
            "type": "string",
            "nullable": true
          },
          "contactStatusId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "taxCode": {
            "type": "string",
            "nullable": true
          },
          "bankAccountNumber": {
            "type": "string",
            "nullable": true
          },
          "bankName": {
            "type": "string",
            "nullable": true
          },
          "bankBranch": {
            "type": "string",
            "nullable": true
          },
          "leadScore": {
            "type": "integer",
            "format": "int32"
          },
          "leadTier": {
            "type": "string",
            "nullable": true
          },
          "referralCodeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "referralCodeKind": {
            "type": "string",
            "nullable": true
          },
          "referralCode": {
            "type": "string",
            "nullable": true
          },
          "firstTouch": {
            "$ref": "#/components/schemas/ContactFirstTouchDto"
          }
        },
        "additionalProperties": false
      },
      "ContactFirstTouchDto": {
        "type": "object",
        "properties": {
          "intakeEventId": {
            "type": "string",
            "format": "uuid"
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "doorType": {
            "type": "string",
            "nullable": true
          },
          "doorName": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourceRaw": {
            "type": "string",
            "nullable": true
          },
          "utmSource": {
            "type": "string",
            "nullable": true
          },
          "utmMedium": {
            "type": "string",
            "nullable": true
          },
          "utmCampaign": {
            "type": "string",
            "nullable": true
          },
          "landingUrl": {
            "type": "string",
            "nullable": true
          },
          "referralRaw": {
            "type": "string",
            "nullable": true
          },
          "referralMatch": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SupplierInfoRefDto": {
        "type": "object",
        "properties": {
          "supplierId": {
            "type": "string",
            "format": "uuid"
          },
          "supplierName": {
            "type": "string",
            "nullable": true
          },
          "supplierCode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CustomerProfileDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tier": {
            "type": "string",
            "nullable": true
          },
          "customerStatus": {
            "type": "string",
            "nullable": true
          },
          "lifetimeValue": {
            "type": "number",
            "format": "double"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "CreateContactRequest": {
        "type": "object",
        "properties": {
          "contactType": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "jobTitle": {
            "type": "string",
            "nullable": true
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "website": {
            "type": "string",
            "nullable": true
          },
          "gender": {
            "type": "string",
            "nullable": true
          },
          "dob": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "identityNumber": {
            "type": "string",
            "nullable": true
          },
          "identityIssuedDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "identityIssuedPlace": {
            "type": "string",
            "nullable": true
          },
          "ward": {
            "type": "string",
            "nullable": true
          },
          "phone2": {
            "type": "string",
            "nullable": true
          },
          "phone3": {
            "type": "string",
            "nullable": true
          },
          "linkedinUrl": {
            "type": "string",
            "nullable": true
          },
          "isDecisionMaker": {
            "type": "boolean"
          },
          "customFields": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourceChannelType": {
            "type": "string",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "keepUnassigned": {
            "type": "boolean"
          },
          "lifecycleStage": {
            "type": "string",
            "nullable": true
          },
          "assigneeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "taxCode": {
            "type": "string",
            "nullable": true
          },
          "bankAccountNumber": {
            "type": "string",
            "nullable": true
          },
          "bankName": {
            "type": "string",
            "nullable": true
          },
          "bankBranch": {
            "type": "string",
            "nullable": true
          },
          "referralCodeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "EnrichmentSuggestionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "field": {
            "type": "string",
            "nullable": true
          },
          "suggestedValue": {
            "type": "string",
            "nullable": true
          },
          "sourceRef": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfWorkspaceActivityDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkspaceActivityDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "WorkspaceActivityDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "activityType": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "contactId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "sourceService": {
            "type": "string",
            "nullable": true
          },
          "actorId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "MessageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "direction": {
            "type": "string",
            "nullable": true
          },
          "senderType": {
            "type": "string",
            "nullable": true
          },
          "senderName": {
            "type": "string",
            "nullable": true
          },
          "messageType": {
            "type": "string",
            "nullable": true
          },
          "content": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttachmentDto"
            },
            "nullable": true
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "failureReason": {
            "type": "string",
            "nullable": true
          },
          "isInternal": {
            "type": "boolean"
          },
          "productSnapshot": {
            "type": "string",
            "nullable": true
          },
          "reactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageReactionDto"
            },
            "nullable": true
          },
          "visibility": {
            "type": "string",
            "nullable": true
          },
          "facebookCommentId": {
            "type": "string",
            "nullable": true
          },
          "facebookParentCommentId": {
            "type": "string",
            "nullable": true
          },
          "buttons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageButtonDto"
            },
            "nullable": true
          },
          "replyToMessageId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "replyToSnippet": {
            "type": "string",
            "nullable": true
          },
          "replyToSenderName": {
            "type": "string",
            "nullable": true
          },
          "senderAvatarUrl": {
            "type": "string",
            "nullable": true
          },
          "mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageMentionDto"
            },
            "nullable": true
          },
          "metadata": {
            "type": "string",
            "nullable": true
          },
          "isRecalled": {
            "type": "boolean"
          },
          "recalledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "commentClusterId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "senderExternalId": {
            "type": "string",
            "nullable": true
          },
          "senderHandle": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MessageMentionDto": {
        "type": "object",
        "properties": {
          "uid": {
            "type": "string",
            "nullable": true
          },
          "offset": {
            "type": "integer",
            "format": "int32"
          },
          "length": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MessageButtonDto": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "nullable": true
          },
          "url": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MessageReactionDto": {
        "type": "object",
        "properties": {
          "emoji": {
            "type": "string",
            "nullable": true
          },
          "actorType": {
            "type": "string",
            "nullable": true
          },
          "actorId": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "AttachmentDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "fileName": {
            "type": "string",
            "nullable": true
          },
          "fileSizeBytes": {
            "type": "integer",
            "format": "int64"
          },
          "mimeType": {
            "type": "string",
            "nullable": true
          },
          "storageKey": {
            "type": "string",
            "nullable": true
          },
          "downloadUrl": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SendMessageRequest": {
        "type": "object",
        "properties": {
          "type": {
            "enum": [
              "Text",
              "Image",
              "File",
              "Audio",
              "Video",
              "Sticker",
              "Location",
              "SystemNote",
              "Product",
              "Comment",
              "Contact"
            ],
            "type": "string"
          },
          "content": {
            "type": "string",
            "nullable": true
          },
          "storageKey": {
            "type": "string",
            "nullable": true
          },
          "fileName": {
            "type": "string",
            "nullable": true
          },
          "fileSizeBytes": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "mimeType": {
            "type": "string",
            "nullable": true
          },
          "clientId": {
            "type": "string",
            "nullable": true
          },
          "productSnapshot": {
            "type": "string",
            "nullable": true
          },
          "visibility": {
            "type": "string",
            "nullable": true
          },
          "mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MentionRequest"
            },
            "nullable": true
          },
          "replyToMessageId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "commentClusterId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "replyToCommentMessageId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MentionRequest": {
        "type": "object",
        "properties": {
          "uid": {
            "type": "string",
            "nullable": true
          },
          "offset": {
            "type": "integer",
            "format": "int32"
          },
          "length": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "BookableClassMemberDto": {
        "type": "object",
        "properties": {
          "gymProfileId": {
            "type": "string",
            "format": "uuid"
          },
          "memberCode": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "avatarUrl": {
            "type": "string",
            "nullable": true
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookableClassSubscriptionDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BookableClassSubscriptionDto": {
        "type": "object",
        "properties": {
          "subscriptionId": {
            "type": "string",
            "format": "uuid"
          },
          "packageId": {
            "type": "string",
            "format": "uuid"
          },
          "packageName": {
            "type": "string",
            "nullable": true
          },
          "sessionsTotal": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "sessionsUsed": {
            "type": "integer",
            "format": "int32"
          },
          "sessionsRemaining": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PtEligibleMemberDto": {
        "type": "object",
        "properties": {
          "gymProfileId": {
            "type": "string",
            "format": "uuid"
          },
          "memberCode": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "subscriptionId": {
            "type": "string",
            "format": "uuid"
          },
          "contractCode": {
            "type": "string",
            "nullable": true
          },
          "packageName": {
            "type": "string",
            "nullable": true
          },
          "sessionsTotal": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "sessionsUsed": {
            "type": "integer",
            "format": "int32"
          },
          "sessionsRemaining": {
            "type": "integer",
            "format": "int32"
          },
          "serviceLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PtMemberServiceLineDto"
            },
            "nullable": true
          },
          "avatarUrl": {
            "type": "string",
            "nullable": true
          },
          "expireDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PtMemberServiceLineDto": {
        "type": "object",
        "properties": {
          "serviceCode": {
            "type": "string",
            "nullable": true
          },
          "sessionCount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "sessionsUsed": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "MemberDuplicateCheckDto": {
        "type": "object",
        "properties": {
          "phoneRule": {
            "type": "string",
            "nullable": true
          },
          "emailRule": {
            "type": "string",
            "nullable": true
          },
          "phoneMatches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MemberLookupDto"
            },
            "nullable": true
          },
          "emailMatches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MemberLookupDto"
            },
            "nullable": true
          },
          "identityRule": {
            "type": "string",
            "nullable": true
          },
          "identityMatches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MemberLookupDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MemberLookupDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "memberCode": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "branchName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MemberByContactDto": {
        "type": "object",
        "properties": {
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "memberCode": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "branchName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MemberDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "branchId": {
            "type": "string",
            "format": "uuid"
          },
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "memberCode": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "gender": {
            "type": "string",
            "nullable": true
          },
          "avatarUrl": {
            "type": "string",
            "nullable": true
          },
          "joinedDate": {
            "type": "string",
            "format": "date"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubscriptionSummaryDto"
            },
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "identityNumber": {
            "type": "string",
            "nullable": true
          },
          "identityIssuedDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "identityIssuedPlace": {
            "type": "string",
            "nullable": true
          },
          "ward": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "phone2": {
            "type": "string",
            "nullable": true
          },
          "phone3": {
            "type": "string",
            "nullable": true
          },
          "assignedStaffId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "assignedStaffName": {
            "type": "string",
            "nullable": true
          },
          "assignedStaffCode": {
            "type": "string",
            "nullable": true
          },
          "industryId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "industryName": {
            "type": "string",
            "nullable": true
          },
          "customerGroupId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customerGroupName": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourceName": {
            "type": "string",
            "nullable": true
          },
          "referredByMemberId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "referredByMemberName": {
            "type": "string",
            "nullable": true
          },
          "referredByMemberCode": {
            "type": "string",
            "nullable": true
          },
          "cardCode": {
            "type": "string",
            "nullable": true
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "contactPersonName": {
            "type": "string",
            "nullable": true
          },
          "contactPersonPhone": {
            "type": "string",
            "nullable": true
          },
          "contactPersonRelationship": {
            "type": "string",
            "nullable": true
          },
          "deviceEmployeeNo": {
            "type": "string",
            "nullable": true
          },
          "taxCode": {
            "type": "string",
            "nullable": true
          },
          "devicePin": {
            "type": "string",
            "nullable": true
          },
          "appAccountWarning": {
            "type": "string",
            "nullable": true
          },
          "contactSyncWarning": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SubscriptionSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "contractCode": {
            "type": "string",
            "nullable": true
          },
          "packageName": {
            "type": "string",
            "nullable": true
          },
          "packageType": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "startDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "endDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "sessionsTotal": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "sessionsUsed": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "pricePaid": {
            "type": "number",
            "format": "double"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "isGroup": {
            "type": "boolean"
          },
          "maxMembers": {
            "type": "integer",
            "format": "int32"
          },
          "groupMemberCount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "groupRole": {
            "type": "string",
            "nullable": true
          },
          "ptId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "approvalStatus": {
            "type": "string",
            "nullable": true
          },
          "activationStatus": {
            "type": "string",
            "nullable": true
          },
          "debtRemaining": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "MemberStatsDto": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int32"
          },
          "joinedToday": {
            "type": "integer",
            "format": "int32"
          },
          "active": {
            "type": "integer",
            "format": "int32"
          },
          "expiringSoon": {
            "type": "integer",
            "format": "int32"
          },
          "noContract": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "MemberTotalsDto": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int32"
          },
          "joinedToday": {
            "type": "integer",
            "format": "int32"
          },
          "active": {
            "type": "integer",
            "format": "int32"
          },
          "expiringSoon": {
            "type": "integer",
            "format": "int32"
          },
          "noContract": {
            "type": "integer",
            "format": "int32"
          },
          "totalSales": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "totalPaid": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "totalDebt": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "canViewTotal": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfMemberSummaryDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MemberSummaryDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "MemberSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "branchId": {
            "type": "string",
            "format": "uuid"
          },
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "memberCode": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "avatarUrl": {
            "type": "string",
            "nullable": true
          },
          "joinedDate": {
            "type": "string",
            "format": "date"
          },
          "isActive": {
            "type": "boolean"
          },
          "activeSubscriptionType": {
            "type": "string",
            "nullable": true
          },
          "activeSubscriptionStartDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "activeSubscriptionEndDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourceName": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "assignedStaffId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "assignedStaffName": {
            "type": "string",
            "nullable": true
          },
          "assignedStaffCode": {
            "type": "string",
            "nullable": true
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "gender": {
            "type": "string",
            "nullable": true
          },
          "isGroupMembership": {
            "type": "boolean"
          },
          "groupRole": {
            "type": "string",
            "nullable": true
          },
          "groupContractCode": {
            "type": "string",
            "nullable": true
          },
          "groupPackageName": {
            "type": "string",
            "nullable": true
          },
          "groupMemberCount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "groupMaxMembers": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "industryName": {
            "type": "string",
            "nullable": true
          },
          "customerGroupName": {
            "type": "string",
            "nullable": true
          },
          "contactPersonName": {
            "type": "string",
            "nullable": true
          },
          "contactPersonPhone": {
            "type": "string",
            "nullable": true
          },
          "contactPersonRelationship": {
            "type": "string",
            "nullable": true
          },
          "standardExpiry": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "classExpiry": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "ptExpiry": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "trainingBranchNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "trainingAllBranches": {
            "type": "boolean"
          },
          "memberDisplayStatus": {
            "type": "string",
            "nullable": true
          },
          "taxCode": {
            "type": "string",
            "nullable": true
          },
          "totalSales": {
            "type": "number",
            "format": "double"
          },
          "totalPaid": {
            "type": "number",
            "format": "double"
          },
          "totalDebt": {
            "type": "number",
            "format": "double"
          },
          "lastCheckinDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "daysSinceLastCheckin": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "loyaltyTierName": {
            "type": "string",
            "nullable": true
          },
          "identityNumber": {
            "type": "string",
            "nullable": true
          },
          "identityIssuedDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "identityIssuedPlace": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "cardCode": {
            "type": "string",
            "nullable": true
          },
          "devicePin": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "district": {
            "type": "string",
            "nullable": true
          },
          "ward": {
            "type": "string",
            "nullable": true
          },
          "phone2": {
            "type": "string",
            "nullable": true
          },
          "phone3": {
            "type": "string",
            "nullable": true
          },
          "referrerName": {
            "type": "string",
            "nullable": true
          },
          "referrerMemberCode": {
            "type": "string",
            "nullable": true
          },
          "createdByName": {
            "type": "string",
            "nullable": true
          },
          "hasCardCredential": {
            "type": "boolean"
          },
          "hasFaceCredential": {
            "type": "boolean"
          },
          "hasFingerprintCredential": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfContractSummaryDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContractSummaryDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "ContractSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "branchId": {
            "type": "string",
            "format": "uuid"
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "contractCode": {
            "type": "string",
            "nullable": true
          },
          "gymProfileId": {
            "type": "string",
            "format": "uuid"
          },
          "memberCode": {
            "type": "string",
            "nullable": true
          },
          "memberName": {
            "type": "string",
            "nullable": true
          },
          "packageName": {
            "type": "string",
            "nullable": true
          },
          "packageType": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "scheduledStartDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "saleStaffId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "saleStaffName": {
            "type": "string",
            "nullable": true
          },
          "startDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "endDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "sessionsTotal": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "sessionsUsed": {
            "type": "integer",
            "format": "int32"
          },
          "totalPaid": {
            "type": "number",
            "format": "double"
          },
          "debtRemaining": {
            "type": "number",
            "format": "double"
          },
          "contractDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "discountPercent": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "totalDiscountAmount": {
            "type": "number",
            "format": "double"
          },
          "activationStatus": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "$ref": "#/components/schemas/ContractCategoryDto"
          },
          "originalPrice": {
            "type": "number",
            "format": "double"
          },
          "totalWithVat": {
            "type": "number",
            "format": "double"
          },
          "durationMonths": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "durationDays": {
            "type": "integer",
            "format": "int32"
          },
          "isRenewal": {
            "type": "boolean"
          },
          "ptId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "ptStaffName": {
            "type": "string",
            "nullable": true
          },
          "orderChannel": {
            "type": "string",
            "nullable": true
          },
          "memberUrl": {
            "type": "string",
            "nullable": true
          },
          "registrationDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "trainingBranchNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "trainingAllBranches": {
            "type": "boolean"
          },
          "saleStaffCode": {
            "type": "string",
            "nullable": true
          },
          "ptStaffCode": {
            "type": "string",
            "nullable": true
          },
          "searchMatches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContractSearchMatchDto"
            },
            "nullable": true
          },
          "packageUnitSnapshot": {
            "type": "string",
            "nullable": true
          },
          "bonusMonths": {
            "type": "integer",
            "format": "int32"
          },
          "bonusDays": {
            "type": "integer",
            "format": "int32"
          },
          "bonusSessions": {
            "type": "integer",
            "format": "int32"
          },
          "serviceValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "carriedValueAmount": {
            "type": "number",
            "format": "double"
          },
          "pureDiscountAmount": {
            "type": "number",
            "format": "double"
          },
          "carriedFromContractCode": {
            "type": "string",
            "nullable": true
          },
          "relationFrom": {
            "$ref": "#/components/schemas/ContractRelationDto"
          },
          "relationTo": {
            "$ref": "#/components/schemas/ContractRelationDto"
          },
          "extensionValue": {
            "type": "number",
            "format": "double"
          },
          "isBranchTransfer": {
            "type": "boolean"
          },
          "isBranchTransferTarget": {
            "type": "boolean"
          },
          "isSessionExhausted": {
            "type": "boolean"
          },
          "approvalStatus": {
            "type": "string",
            "nullable": true
          },
          "memberDateOfBirth": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "memberPhone": {
            "type": "string",
            "nullable": true
          },
          "memberEmail": {
            "type": "string",
            "nullable": true
          },
          "memberAddress": {
            "type": "string",
            "nullable": true
          },
          "memberGender": {
            "type": "string",
            "nullable": true
          },
          "memberGroupName": {
            "type": "string",
            "nullable": true
          },
          "memberSource": {
            "type": "string",
            "nullable": true
          },
          "memberDevicePin": {
            "type": "string",
            "nullable": true
          },
          "memberCardCode": {
            "type": "string",
            "nullable": true
          },
          "contractKind": {
            "type": "string",
            "nullable": true
          },
          "activatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "promotionName": {
            "type": "string",
            "nullable": true
          },
          "isSigned": {
            "type": "boolean"
          },
          "signedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signedByName": {
            "type": "string",
            "nullable": true
          },
          "createdByName": {
            "type": "string",
            "nullable": true
          },
          "updatedByName": {
            "type": "string",
            "nullable": true
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "maxMembers": {
            "type": "integer",
            "format": "int32"
          },
          "groupMemberNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "remainingValue": {
            "type": "number",
            "format": "double"
          },
          "usedValue": {
            "type": "number",
            "format": "double"
          },
          "consumedFreezeDays": {
            "type": "integer",
            "format": "int32"
          },
          "invoiceRequested": {
            "type": "boolean"
          },
          "invoiceTaxCode": {
            "type": "string",
            "nullable": true
          },
          "invoiceCompanyName": {
            "type": "string",
            "nullable": true
          },
          "invoiceAddress": {
            "type": "string",
            "nullable": true
          },
          "invoiceBuyerName": {
            "type": "string",
            "nullable": true
          },
          "invoiceEmail": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ContractRelationDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "nullable": true
          },
          "contractId": {
            "type": "string",
            "format": "uuid"
          },
          "contractCode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ContractSearchMatchDto": {
        "type": "object",
        "properties": {
          "memberName": {
            "type": "string",
            "nullable": true
          },
          "memberCode": {
            "type": "string",
            "nullable": true
          },
          "matchedField": {
            "type": "string",
            "nullable": true
          },
          "isGroupMember": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ContractCategoryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true
          },
          "isSystem": {
            "type": "boolean"
          },
          "code": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PagedResultOfCheckInDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckInDto"
            },
            "nullable": true
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "hasNextPage": {
            "type": "boolean",
            "readOnly": true
          },
          "hasPreviousPage": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "CheckInDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "branchId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "gymProfileId": {
            "type": "string",
            "format": "uuid"
          },
          "memberCode": {
            "type": "string",
            "nullable": true
          },
          "memberName": {
            "type": "string",
            "nullable": true
          },
          "checkinType": {
            "type": "string",
            "nullable": true
          },
          "credentialType": {
            "type": "string",
            "nullable": true
          },
          "checkinTime": {
            "type": "string",
            "format": "date-time"
          },
          "checkoutTime": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "isValid": {
            "type": "boolean"
          },
          "invalidReason": {
            "type": "string",
            "nullable": true
          },
          "isManualOverride": {
            "type": "boolean"
          },
          "deviceName": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "zoneId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "accessDecision": {
            "type": "string",
            "nullable": true
          },
          "denyReason": {
            "type": "string",
            "nullable": true
          },
          "ticketId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "ticketCode": {
            "type": "string",
            "nullable": true
          },
          "guestName": {
            "type": "string",
            "nullable": true
          },
          "guestPhone": {
            "type": "string",
            "nullable": true
          },
          "subscriptionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "contractCode": {
            "type": "string",
            "nullable": true
          },
          "packageName": {
            "type": "string",
            "nullable": true
          },
          "avatarKey": {
            "type": "string",
            "nullable": true
          },
          "branchName": {
            "type": "string",
            "nullable": true
          },
          "avatarUrl": {
            "type": "string",
            "nullable": true
          },
          "subscriptionStatus": {
            "type": "string",
            "nullable": true
          },
          "subscriptionExpireDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "subscriptionTotalSessions": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "subscriptionUsedSessions": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "packageMode": {
            "type": "string",
            "nullable": true
          },
          "sessionsRemainingSnapshot": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "ptId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "ptName": {
            "type": "string",
            "nullable": true
          },
          "sessionsDeducted": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "serviceCode": {
            "type": "string",
            "nullable": true
          },
          "checkinSource": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "packageType": {
            "type": "string",
            "nullable": true
          },
          "groupMemberAllocation": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "groupMemberRemaining": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "hasPhoto": {
            "type": "boolean"
          },
          "photoUrl": {
            "type": "string",
            "nullable": true
          },
          "registeredFaceUrl": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "debtRemaining": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "checkinCountToday": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "memberNote": {
            "type": "string",
            "nullable": true
          },
          "contractNote": {
            "type": "string",
            "nullable": true
          },
          "packageNote": {
            "type": "string",
            "nullable": true
          },
          "ptCode": {
            "type": "string",
            "nullable": true
          },
          "ptAvatarUrl": {
            "type": "string",
            "nullable": true
          },
          "gymHours": {
            "type": "string",
            "nullable": true
          },
          "saleStaffName": {
            "type": "string",
            "nullable": true
          },
          "daysRemaining": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    }
  }
}