openapi: 3.0.3
info:
  title: API v4 - Fortics SZ4
  version: "4.0"
  description: >-
    Documentação da API v4 baseada apenas nas rotas versionadas (/v4) em
    routes/api.php. Rotas legadas e não versionadas foram excluídas.
servers:
  - url: /api
    description: Base da API
paths:
  /v4/session/initSession:
    post:
      tags: [Session]
      summary: Iniciar sessão
      description: |-
        Inicia sessão com os dados informados.
      operationId: postV4SessionInitSession
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SessionInitRequest'
            example:
              contact_id: "65d1a2f0c2d9b"
              platform: "Whatsapp"
              channel_id: "659f1c"
              attendance: "65c9e"
              agent_id: "agent_123"
              agent_name: "Maria"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ValidationError'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/session/nextAttendance:
    post:
      tags: [Session]
      summary: Próximo atendimento
      description: |-
        Processa a solicitação de próximo atendimento e retorna o resultado.
      operationId: postV4SessionNextAttendance
      security:
        - JwtAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              agent_id: "agent_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/session/check:
    post:
      tags: [Session]
      summary: Verificar sessão
      description: |-
        Verifica sessão e retorna o estado atual.
      operationId: postV4SessionCheck
      security:
        - JwtAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/release:
    get:
      tags: [Release]
      summary: Obter versão de release
      description: |-
        Recupera versão de release.
      operationId: getV4Release
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/auth/login:
    post:
      tags: [Auth]
      summary: Login
      description: |-
        Processa a solicitação de login e retorna o resultado.
      operationId: postV4AuthLogin
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthLoginRequest'
            example:
              email: "agent@example.com"
              password: "senha123"
              device_token: "device_token_abc"
              accept_token_service: true
              is_contact_center: false
      responses:
        '200':
          $ref: '#/components/responses/AuthLoginSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/auth/login-v2:
    post:
      tags: [Auth]
      summary: Login v2
      description: |-
        Processa a solicitação de login v2 e retorna o resultado.
      operationId: postV4AuthLoginV2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthLoginRequest'
            example:
              email: "agent@example.com"
              password: "senha123"
              is_contact_center: false
      responses:
        '200':
          $ref: '#/components/responses/AuthLoginSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/auth/logout:
    get:
      tags: [Auth]
      summary: Logout
      description: |-
        Processa a solicitação de logout e retorna o resultado.
      operationId: getV4AuthLogout
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: type
          schema:
            type: string
            enum: [api]
          description: Tipo de autenticação.
          required: false
          example: api
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/auth/refresh:
    get:
      tags: [Auth]
      summary: Atualizar token
      description: |-
        Atualiza token conforme os dados enviados.
      operationId: getV4AuthRefresh
      security:
        - JwtAuth: []
      responses:
        '200':
          description: Token renovado.
          content:
            application/json:
              schema:
                type: object
                properties:
                  token:
                    type: string
              example:
                token: "jwt.token.renovado"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/auth/me:
    get:
      tags: [Auth]
      summary: Obter usuário autenticado
      description: |-
        Recupera usuário autenticado.
      operationId: getV4AuthMe
      security:
        - JwtAuth: []
      responses:
        '200':
          description: Dados do usuário atual.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthMeResponse'
              example:
                _id: "user_123"
                email: "agent@example.com"
                name: "Agente 01"
                session_agent:
                  _id: "session_agent_1"
                keep_alive: 30
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v4/autoresponse/message:
    post:
      tags: [Autoresponse]
      summary: Enviar mensagem para auto responder
      description: |-
        Envia mensagem para auto responder com os dados informados.
      operationId: postV4AutoresponseMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              session_id: "session_123"
              message: "Olá!"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/whatsapp/attendances:
    post:
      tags: [Attendances]
      summary: Criar atendimento via integração WhatsApp
      description: |-
        Cria atendimento via integração WhatsApp com os dados enviados.
      operationId: postV4WhatsappAttendances
      security:
        - IntegrationApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              contact_id: "contact_123"
              channel_id: "channel_123"
              message: "Olá"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /v4/message/send:
    get:
      tags: [Messages]
      summary: Enviar mensagem (GET)
      description: |-
        Observação: Endpoint com efeito colateral via GET.
      operationId: getV4MessageSend
      security:
        - ApiTokenQuery: []
      parameters:
        - in: query
          name: token
          required: true
          schema:
            type: string
          description: Token de autenticação.
          example: "token_api"
        - in: query
          name: platform_id
          required: true
          schema:
            type: string
        - in: query
          name: channel_id
          required: true
          schema:
            type: string
        - in: query
          name: type
          required: true
          schema:
            type: string
            enum: [text, media]
        - in: query
          name: message
          required: false
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/MessageSendSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ValidationError'
        '500':
          $ref: '#/components/responses/ServerError'
    post:
      tags: [Messages]
      summary: Enviar mensagem
      description: |-
        Envia mensagem com os dados informados.
      operationId: postV4MessageSend
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
            example:
              platform_id: "contact_platform"
              channel_id: "channel_123"
              type: "text"
              message: "Olá"
      responses:
        '200':
          $ref: '#/components/responses/MessageSendSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ValidationError'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/message/send_plus:
    get:
      tags: [Messages]
      summary: Enviar mensagem (GET) - send_plus
      description: |-
        Observação: Endpoint com efeito colateral via GET.
      operationId: getV4MessageSendPlus
      security:
        - ApiTokenQuery: []
      parameters:
        - in: query
          name: token
          required: true
          schema:
            type: string
          description: Token de autenticação.
          example: "token_api"
      responses:
        '200':
          $ref: '#/components/responses/MessageSendSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ValidationError'
        '500':
          $ref: '#/components/responses/ServerError'
    post:
      tags: [Messages]
      summary: Enviar mensagem (send_plus)
      description: |-
        Envia mensagem com os dados informados.
      operationId: postV4MessageSendPlus
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
            example:
              platform_id: "contact_platform"
              channel_id: "channel_123"
              type: "text"
              message: "Olá"
              contact_variables:
                name: "Cliente"
      responses:
        '200':
          $ref: '#/components/responses/MessageSendSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ValidationError'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/message/read:
    post:
      tags: [Messages]
      summary: Marcar mensagens como lidas
      description: |-
        Marca mensagens como lidas conforme os parâmetros informados.
      operationId: postV4MessageRead
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageReadRequest'
            example:
              platform_id: "platform_123"
              channel_id: "channel_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/message/pending:
    post:
      tags: [Messages]
      summary: Obter quantidade de mensagens pendentes
      description: |-
        Recupera quantidade de mensagens pendentes.
      operationId: postV4MessagePending
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageReadRequest'
            example:
              platform_id: "platform_123"
              channel_id: "channel_123"
      responses:
        '200':
          description: Contagem de pendentes.
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
              example:
                count: 3
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/message/replace_vars:
    post:
      tags: [Messages]
      summary: Substituir variáveis de mensagem
      description: |-
        Processa a solicitação de substituir variáveis de mensagem e retorna o resultado.
      operationId: postV4MessageReplaceVars
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
                session_id:
                  type: string
              required: [message, session_id]
            example:
              message: "Olá {nome}"
              session_id: "session_123"
      responses:
        '200':
          description: Mensagem com variáveis substituídas.
          content:
            application/json:
              schema:
                type: string
              example: "Olá Maria"
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/message/{messageId}/annotation:
    post:
      tags: [Messages]
      summary: Criar anotação de mensagem
      description: |-
        Cria anotação de mensagem com os dados enviados.
      operationId: postV4MessageAnnotation
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: messageId
          required: true
          schema:
            type: string
          description: Identificador da mensagem.
          example: "msg_123"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnnotationMessageRequest'
            example:
              annotation: "Mensagem importante"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
    delete:
      tags: [Messages]
      summary: Remover anotação de mensagem
      description: |-
        Remove anotação de mensagem identificado no caminho.
      operationId: deleteV4MessageAnnotation
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: messageId
          required: true
          schema:
            type: string
          description: Identificador da mensagem.
          example: "msg_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '404':
          $ref: '#/components/responses/NotFound'
  /v4/user/agents/update:
    put:
      tags: [Agents]
      summary: Atualizar dados do agente
      description: |-
        Atualiza dados do agente conforme os dados enviados.
      operationId: putV4UserAgentsUpdate
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAgentRequest'
            example:
              name: "Agente 01"
              ramal: 100
              password: "senha_atual"
              new_password: "nova_senha"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/user/agents/online:
    get:
      tags: [Agents]
      summary: Listar agentes online
      description: |-
        Retorna agentes online conforme filtros enviados.
      operationId: getV4UserAgentsOnline
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: paginate
          schema:
            type: boolean
          description: Paginar resultados.
          example: true
        - in: query
          name: allUsers
          schema:
            type: boolean
          description: Listar todos os usuários.
          example: false
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/login:
    post:
      tags: [Agents]
      summary: Login do agente
      description: |-
        Processa a solicitação de login do agente e retorna o resultado.
      operationId: postV4UserAgentsLogin
      security:
        - JwtAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/logout:
    post:
      tags: [Agents]
      summary: Logout do agente
      description: |-
        Processa a solicitação de logout do agente e retorna o resultado.
      operationId: postV4UserAgentsLogout
      security:
        - JwtAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              reason: "manual"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/campaigns:
    get:
      tags: [Agents]
      summary: Campanhas disponíveis para o agente
      description: |-
        Processa a solicitação de campanhas disponíveis para o agente e retorna o resultado.
      operationId: getV4UserAgentsCampaigns
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/grades:
    get:
      tags: [Agents]
      summary: Média de notas do agente
      description: |-
        Processa a solicitação de média de notas do agente e retorna o resultado.
      operationId: getV4UserAgentsGrades
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/toggle/campaign:
    post:
      tags: [Agents]
      summary: Ativar ou desativar campanha do agente
      description: |-
        Alterna campanha do agente conforme o estado informado.
      operationId: postV4UserAgentsToggleCampaign
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                campaign_id:
                  type: string
              required: [campaign_id]
            example:
              campaign_id: "camp_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/attendances:
    get:
      tags: [Agents]
      summary: Listar atendimentos do agente
      description: |-
        Retorna atendimentos do agente conforme filtros enviados.
      operationId: getV4UserAgentsAttendances
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/attendances_plus:
    get:
      tags: [Agents]
      summary: Listar atendimentos do agente (com paginação)
      description: |-
        Retorna atendimentos do agente conforme filtros enviados.
      operationId: getV4UserAgentsAttendancesPlus
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: name
          schema:
            type: string
          description: Filtro por nome.
          example: "Cliente"
        - in: query
          name: paginateAttendance
          schema:
            type: boolean
          example: false
        - in: query
          name: pageAttendance
          schema:
            type: integer
            minimum: 1
          example: 1
        - in: query
          name: paginateWait
          schema:
            type: boolean
          example: false
        - in: query
          name: pageWait
          schema:
            type: integer
            minimum: 1
          example: 1
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/sessions/attendances:
    get:
      tags: [Agents]
      summary: Listar sessões em atendimento
      description: |-
        Retorna sessões em atendimento conforme filtros enviados.
      operationId: getV4UserAgentsSessionsAttendances
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: name
          schema:
            type: string
          example: "Cliente"
        - in: query
          name: paginate
          schema:
            type: boolean
          example: true
        - in: query
          name: page
          schema:
            type: integer
            minimum: 1
          example: 1
        - in: query
          name: contact_plus
          schema:
            type: boolean
          example: false
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/sessions/waits:
    get:
      tags: [Agents]
      summary: Listar sessões em espera
      description: |-
        Retorna sessões em espera conforme filtros enviados.
      operationId: getV4UserAgentsSessionsWaits
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: name
          schema:
            type: string
          example: "Cliente"
        - in: query
          name: paginate
          schema:
            type: boolean
          example: true
        - in: query
          name: page
          schema:
            type: integer
            minimum: 1
          example: 1
        - in: query
          name: contact_plus
          schema:
            type: boolean
          example: false
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/list/tagsCategory:
    get:
      tags: [Tags]
      summary: Listar tags de categoria
      description: |-
        Retorna tags de categoria conforme filtros enviados.
      operationId: getV4UserAgentsTagsCategory
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: name
          schema:
            type: string
          example: "Suporte"
        - in: query
          name: paginate
          schema:
            type: boolean
          example: false
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/session/setTagCategory:
    post:
      tags: [Tags]
      summary: Definir tag de categoria da sessão
      description: |-
        Define tag de categoria da sessão para a sessão informada.
      operationId: postV4UserAgentsSessionSetTagCategory
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetTagCategoryRequest'
            example:
              session_id: "session_123"
              tag_id: "tag_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/user/agents/session/deleteTagCategory:
    delete:
      tags: [Tags]
      summary: Remover tag de categoria da sessão
      description: |-
        Remove tag de categoria da sessão identificado no caminho.
      operationId: deleteV4UserAgentsSessionDeleteTagCategory
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteTagCategoryRequest'
            example:
              session_id: "session_123"
              tag_id: "tag_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/user/agents/pauses:
    get:
      tags: [Agents]
      summary: Listar pausas ativas
      description: |-
        Retorna pausas ativas conforme filtros enviados.
      operationId: getV4UserAgentsPauses
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/pauses/start:
    post:
      tags: [Agents]
      summary: Iniciar pausa
      description: |-
        Inicia pausa com os dados informados.
      operationId: postV4UserAgentsPausesStart
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PauseStartRequest'
            example:
              pause_id: "pause_123"
              isPausePersonalized: false
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/user/agents/pauses/stop:
    post:
      tags: [Agents]
      summary: Encerrar pausa
      description: |-
        Encerra pausa conforme a sessão informada.
      operationId: postV4UserAgentsPausesStop
      security:
        - JwtAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              reason: "fim"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/pauses/timeout/event/admin:
    post:
      tags: [Agents]
      summary: Evento de timeout de pausa
      description: |-
        Processa a solicitação de evento de timeout de pausa e retorna o resultado.
      operationId: postV4UserAgentsPausesTimeoutEventAdmin
      security:
        - JwtAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              pause_id: "pause_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/pauses/progress:
    get:
      tags: [Agents]
      summary: Buscar pausa em progresso
      description: |-
        Pesquisa pausa em progresso conforme critérios enviados.
      operationId: getV4UserAgentsPausesProgress
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/messages:
    get:
      tags: [Agents]
      summary: Listar mensagens do chat do agente
      description: |-
        Retorna mensagens do chat do agente conforme filtros enviados.
      operationId: getV4UserAgentsMessages
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/messages/send:
    post:
      tags: [Agents]
      summary: Enviar mensagem do chat do agente
      description: |-
        Envia mensagem do chat do agente com os dados informados.
      operationId: postV4UserAgentsMessagesSend
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              message: "Olá"
              agent_id: "agent_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/messages/read/{agent_id}:
    get:
      tags: [Agents]
      summary: Marcar mensagens como lidas (chat)
      description: |-
        Marca mensagens como lidas conforme os parâmetros informados.
      operationId: getV4UserAgentsMessagesRead
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: agent_id
          required: true
          schema:
            type: string
          description: ID do agente.
          example: "agent_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/messages/pending:
    post:
      tags: [Agents]
      summary: Mensagens pendentes (chat)
      description: |-
        Processa a solicitação de mensagens pendentes e retorna o resultado.
      operationId: postV4UserAgentsMessagesPending
      security:
        - JwtAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              agent_id: "agent_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agents/uploadLimit:
    get:
      tags: [Agents]
      summary: Limite de upload do agente
      description: |-
        Processa a solicitação de limite de upload do agente e retorna o resultado.
      operationId: getV4UserAgentsUploadLimit
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/channel/hsm:
    get:
      tags: [HSM]
      summary: Listar HSMs do canal
      description: |-
        Retorna hSMs do canal conforme filtros enviados.
      operationId: getV4ChannelHsm
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agent/copilot/list:
    get:
      tags: [Agents]
      summary: Listar copilot
      description: |-
        Retorna copilot conforme filtros enviados.
      operationId: getV4UserAgentCopilotList
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agent/copilot/execute:
    post:
      tags: [Agents]
      summary: Executar copilot
      description: |-
        Processa a solicitação de executar copilot e retorna o resultado.
      operationId: postV4UserAgentCopilotExecute
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              prompt: "Resuma a conversa"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agent/webrtc/{id}:
    get:
      tags: [Agents]
      summary: Obter dados WebRTC
      description: |-
        Recupera dados WebRTC.
      operationId: getV4UserAgentWebrtc
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: ID do agente ou sessão.
          example: "agent_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agent/placeholders:
    post:
      tags: [Agents]
      summary: Listar placeholders
      description: |-
        Retorna placeholders conforme filtros enviados.
      operationId: postV4UserAgentPlaceholders
      security:
        - JwtAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/user/agent/stt/translate:
    post:
      tags: [Agents]
      summary: Traduzir mensagem
      description: |-
        Processa a solicitação de traduzir mensagem e retorna o resultado.
      operationId: postV4UserAgentSttTranslate
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TranslateMessageRequest'
            example:
              language: "pt"
              message: "Hello"
              session_id: "session_123"
              message_id: "msg_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/user/agent/stt/translate/detect:
    post:
      tags: [Agents]
      summary: Detectar idioma
      description: |-
        Processa a solicitação de detectar idioma e retorna o resultado.
      operationId: postV4UserAgentSttDetect
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DetectLanguageRequest'
            example:
              message: "Bonjour"
              contact_id: "contact_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/user/agent/stt/translate/activeAutoTranslate:
    post:
      tags: [Agents]
      summary: Ativar/desativar auto tradução
      description: |-
        Alterna auto tradução conforme o estado informado.
      operationId: postV4UserAgentSttActiveAutoTranslate
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToggleAutoTranslateRequest'
            example:
              session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/user/agent/call:
    post:
      tags: [Agents]
      summary: Realizar chamada para contato
      description: |-
        Processa a solicitação de realizar chamada para contato e retorna o resultado.
      operationId: postV4UserAgentCall
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClickToCallRequest'
            example:
              contact_id: "contact_123"
              whatsapp: true
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/attendances:
    get:
      tags: [Attendances]
      summary: Listar sessões de atendimento
      description: |-
        Retorna sessões de atendimento conforme filtros enviados.
      operationId: getV4Attendances
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: _id
          schema:
            type: string
          example: "session_123"
        - in: query
          name: status
          schema:
            type: string
          example: "wait"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Attendances]
      summary: Exibir dados de uma sessão
      description: |-
        Processa a solicitação de exibir dados de uma sessão e retorna o resultado.
      operationId: postV4AttendancesShow
      security:
        - JwtAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                session_id:
                  type: string
                contact_id:
                  type: string
                platform_id:
                  type: string
                protocol:
                  type: string
              example:
                session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/attendances/phase/{session_phase}:
    get:
      tags: [Attendances]
      summary: Listar sessões por fase
      description: |-
        Retorna sessões por fase conforme filtros enviados.
      operationId: getV4AttendancesByPhase
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: session_phase
          required: true
          schema:
            type: string
            description: Fase da sessão.
          example: human
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/attendances/accept:
    post:
      tags: [Attendances]
      summary: Aceitar atendimento em espera
      description: |-
        Aceita atendimento em espera com base nos identificadores enviados.
      operationId: postV4AttendancesAccept
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                session_id:
                  type: string
                attendance_id:
                  type: string
                agent:
                  type: string
                  format: email
              required: [session_id]
            example:
              session_id: "session_123"
              attendance_id: "camp_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '409':
          $ref: '#/components/responses/Conflict'
  /v4/attendances/session/init:
    post:
      tags: [Attendances]
      summary: Iniciar sessão de atendimento
      description: |-
        Inicia sessão de atendimento com os dados informados.
      operationId: postV4AttendancesSessionInit
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AttendanceInitSessionRequest'
            example:
              contact_id: "contact_123"
              platform: "Whatsapp"
              channel_id: "channel_123"
              team_id: "camp_123"
              agent_id: "agent_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/attendances/finish:
    post:
      tags: [Attendances]
      summary: Encerrar atendimento
      description: |-
        Encerra atendimento conforme a sessão informada.
      operationId: postV4AttendancesFinish
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                session_id:
                  type: string
                tabulation_id:
                  type: string
              required: [session_id]
            example:
              session_id: "session_123"
              tabulation_id: "tab_123"
      responses:
        '200':
          description: Atendimento encerrado.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  response:
                    type: string
              example:
                status: 200
                response: "Atendimento finalizado"
        '404':
          $ref: '#/components/responses/NotFound'
  /v4/attendances/tags/{id}:
    get:
      tags: [Attendances]
      summary: Obter tags da sessão
      description: |-
        Recupera tags da sessão.
      operationId: getV4AttendancesTags
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/attendances/transfer:
    post:
      tags: [Attendances]
      summary: Transferir atendimento
      description: |-
        Transfere atendimento para o destino informado.
      operationId: postV4AttendancesTransfer
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransferRequest'
            example:
              session_id: "session_123"
              type: "attendance"
              attendance_id: "camp_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
  /v4/attendances/conference/invite:
    post:
      tags: [Attendances]
      summary: Convidar agente para conferência
      description: |-
        Processa a solicitação de convidar agente para conferência e retorna o resultado.
      operationId: postV4AttendancesConferenceInvite
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                session_id:
                  type: string
                agent_id:
                  type: string
              required: [session_id, agent_id]
            example:
              session_id: "session_123"
              agent_id: "agent_456"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
  /v4/attendances/conference/accept:
    post:
      tags: [Attendances]
      summary: Aceitar convite de conferência
      description: |-
        Aceita convite de conferência com base nos identificadores enviados.
      operationId: postV4AttendancesConferenceAccept
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                session_id:
                  type: string
                accept:
                  type: boolean
              required: [session_id, accept]
            example:
              session_id: "session_123"
              accept: true
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '404':
          $ref: '#/components/responses/NotFound'
  /v4/attendances/conference/finish:
    post:
      tags: [Attendances]
      summary: Encerrar conferência
      description: |-
        Encerra conferência conforme a sessão informada.
      operationId: postV4AttendancesConferenceFinish
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                session_id:
                  type: string
              required: [session_id]
            example:
              session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
  /v4/attendances/historic:
    post:
      tags: [Attendances]
      summary: Listar histórico de sessões do contato
      description: |-
        Retorna histórico de sessões do contato conforme filtros enviados.
      operationId: postV4AttendancesHistoric
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              contact_id: "contact_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/attendances/historic/period:
    post:
      tags: [Attendances]
      summary: Histórico por período
      description: |-
        Processa a solicitação de histórico por período e retorna o resultado.
      operationId: postV4AttendancesHistoricPeriod
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              contact_id: "contact_123"
              period: "2024-01"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/attendances/historic/messages:
    post:
      tags: [Attendances]
      summary: Histórico de mensagens
      description: |-
        Processa a solicitação de histórico de mensagens e retorna o resultado.
      operationId: postV4AttendancesHistoricMessages
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/attendances/historic/protocol:
    post:
      tags: [Attendances]
      summary: Histórico por protocolo
      description: |-
        Processa a solicitação de histórico por protocolo e retorna o resultado.
      operationId: postV4AttendancesHistoricProtocol
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              protocol: "ABC-123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/attendances/historic/interval:
    get:
      tags: [Attendances]
      summary: Histórico por intervalo
      description: |-
        Processa a solicitação de histórico por intervalo e retorna o resultado.
      operationId: getV4AttendancesHistoricInterval
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: start
          schema:
            type: string
          example: "2024-01-01"
        - in: query
          name: end
          schema:
            type: string
          example: "2024-01-31"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/session/init:
    post:
      tags: [Attendances]
      summary: Iniciar sessão (atalho)
      description: |-
        Inicia sessão com os dados informados.
      operationId: postV4SessionInit
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AttendanceInitSessionRequest'
            example:
              contact_id: "contact_123"
              platform: "Whatsapp"
              channel_id: "channel_123"
              team_id: "camp_123"
              agent_id: "agent_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/merge/similar:
    get:
      tags: [Contacts]
      summary: Buscar contatos similares
      description: |-
        Pesquisa contatos similares conforme critérios enviados.
      operationId: getV4ContactsMergeSimilar
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: contact_id
          required: true
          schema:
            type: string
          example: "contact_123"
        - in: query
          name: search
          schema:
            type: string
          example: "Maria"
        - in: query
          name: per_page
          schema:
            type: number
            minimum: 1
          example: 10
        - in: query
          name: page
          schema:
            type: number
            minimum: 1
          example: 1
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/contacts/merge/link:
    post:
      tags: [Contacts]
      summary: Vincular contatos (merge)
      description: |-
        Processa a solicitação de vincular contatos e retorna o resultado.
      operationId: postV4ContactsMergeLink
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              main_contact_id: "contact_1"
              merge_contact_id: "contact_2"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/related:
    get:
      tags: [Contacts]
      summary: Listar contatos relacionados
      description: |-
        Retorna contatos relacionados conforme filtros enviados.
      operationId: getV4ContactsRelated
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: contact_id
          required: true
          schema:
            type: string
          example: "contact_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/unmerge:
    post:
      tags: [Contacts]
      summary: Desvincular contato
      description: |-
        Processa a solicitação de desvincular contato e retorna o resultado.
      operationId: postV4ContactsUnmerge
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              contact_id: "contact_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/agent/historic/medias:
    get:
      tags: [Contacts]
      summary: Listar mídias do contato
      description: |-
        Retorna mídias do contato conforme filtros enviados.
      operationId: getV4ContactsHistoricMedias
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: contact_id
          required: true
          schema:
            type: string
          example: "contact_123"
        - in: query
          name: type
          schema:
            type: string
            enum: [sounds, files, images, videos]
          example: images
        - in: query
          name: limit
          schema:
            type: number
            minimum: 5
            maximum: 50
          example: 5
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/hsm:
    get:
      tags: [HSM]
      summary: Listar templates HSM
      description: |-
        Retorna templates HSM conforme filtros enviados.
      operationId: getV4HsmList
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/hsm/content:
    get:
      tags: [HSM]
      summary: Listar templates HSM com tags
      description: |-
        Retorna templates HSM com tags conforme filtros enviados.
      operationId: getV4HsmContent
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/hsm/exist:
    get:
      tags: [HSM]
      summary: Verificar sessão HSM
      description: |-
        Verifica sessão HSM e retorna o estado atual.
      operationId: getV4HsmExist
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/hsm/listSz:
    get:
      tags: [HSM]
      summary: Listar HSMs SZ
      description: |-
        Retorna hSMs SZ conforme filtros enviados.
      operationId: getV4HsmListSz
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/hsm/listAll:
    post:
      tags: [HSM]
      summary: Listar todos os templates HSM
      description: |-
        Retorna todos os templates HSM conforme filtros enviados.
      operationId: postV4HsmListAll
      security:
        - JwtAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListAllHsmTemplatesRequest'
            example:
              attendance_id: "camp_123"
              channel_id: "channel_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/admins:
    get:
      tags: [Admin]
      summary: Listar administradores
      description: |-
        Retorna administradores conforme filtros enviados.
      operationId: getV4Admins
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Admin]
      summary: Criar administrador
      description: |-
        Cria administrador com os dados enviados.
      operationId: postV4Admins
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Admin"
              email: "admin@example.com"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/admins/{id}:
    get:
      tags: [Admin]
      summary: Detalhar administrador
      description: |-
        Recupera os dados de administrador identificado no caminho.
      operationId: getV4AdminsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "admin_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    put:
      tags: [Admin]
      summary: Atualizar administrador
      description: |-
        Atualiza administrador conforme os dados enviados.
      operationId: putV4AdminsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Admin 2"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Admin]
      summary: Remover administrador
      description: |-
        Remove administrador identificado no caminho.
      operationId: deleteV4AdminsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/admins/groups:
    get:
      tags: [Admin]
      summary: Listar grupos de administradores
      description: |-
        Retorna grupos de administradores conforme filtros enviados.
      operationId: getV4AdminsGroups
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/storage:
    get:
      tags: [Admin]
      summary: Status de armazenamento
      description: |-
        Processa a solicitação de status de armazenamento e retorna o resultado.
      operationId: getV4Storage
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/storage/{type}:
    get:
      tags: [Admin]
      summary: Listar arquivos por tipo
      description: |-
        Retorna arquivos por tipo conforme filtros enviados.
      operationId: getV4StorageByType
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: type
          required: true
          schema:
            type: string
          example: "images"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/storage/upload:
    post:
      tags: [Admin]
      summary: Upload de arquivo
      description: |-
        Processa a solicitação de upload de arquivo e retorna o resultado.
      operationId: postV4StorageUpload
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
            example:
              file: "<arquivo>"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/reports/attendances:
    get:
      tags: [Admin]
      summary: Relatório de atendimentos
      description: |-
        Processa a solicitação de relatório de atendimentos e retorna o resultado.
      operationId: getV4ReportsAttendances
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/application:
    get:
      tags: [Admin]
      summary: Obter configuração da aplicação
      description: |-
        Recupera configuração da aplicação.
      operationId: getV4Application
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    put:
      tags: [Admin]
      summary: Atualizar configuração da aplicação
      description: |-
        Atualiza configuração da aplicação conforme os dados enviados.
      operationId: putV4Application
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Minha Aplicação"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/application/attendance:
    get:
      tags: [Admin]
      summary: Obter configurações de notas de atendimento
      description: |-
        Recupera configurações de notas de atendimento.
      operationId: getV4ApplicationAttendance
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    put:
      tags: [Admin]
      summary: Atualizar notas de atendimento
      description: |-
        Atualiza notas de atendimento conforme os dados enviados.
      operationId: putV4ApplicationAttendance
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplicationAttendanceRequest'
            example:
              initial_grade: 1
              final_grade: 5
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/application/messages:
    get:
      tags: [Admin]
      summary: Obter mensagens automáticas
      description: |-
        Recupera mensagens automáticas.
      operationId: getV4ApplicationMessages
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    put:
      tags: [Admin]
      summary: Atualizar mensagens automáticas
      description: |-
        Atualiza mensagens automáticas conforme os dados enviados.
      operationId: putV4ApplicationMessages
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              welcome_message: "Olá!"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/blockedNumbers:
    get:
      tags: [Admin]
      summary: Listar números bloqueados
      description: |-
        Retorna números bloqueados conforme filtros enviados.
      operationId: getV4BlockedNumbers
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Admin]
      summary: Adicionar número bloqueado
      description: |-
        Adiciona número bloqueado conforme os dados enviados.
      operationId: postV4BlockedNumbers
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              number: "+558899999999"
              reason: "spam"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/blockedNumbers/{id}:
    get:
      tags: [Admin]
      summary: Detalhar número bloqueado
      description: |-
        Recupera os dados de número bloqueado identificado no caminho.
      operationId: getV4BlockedNumbersById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "blocked_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    put:
      tags: [Admin]
      summary: Atualizar número bloqueado
      description: |-
        Atualiza número bloqueado conforme os dados enviados.
      operationId: putV4BlockedNumbersById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              number: "+558899999999"
              reason: "fraude"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Admin]
      summary: Remover número bloqueado
      description: |-
        Remove número bloqueado identificado no caminho.
      operationId: deleteV4BlockedNumbersById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/wordFilter/agents:
    get:
      tags: [Admin]
      summary: Listar filtro de palavras (agentes)
      description: |-
        Retorna filtro de palavras conforme filtros enviados.
      operationId: getV4WordFilterAgents
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Admin]
      summary: Adicionar filtro de palavras (agentes)
      description: |-
        Adiciona filtro de palavras conforme os dados enviados.
      operationId: postV4WordFilterAgents
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              word: "proibida"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/wordFilter/agents/{id}:
    put:
      tags: [Admin]
      summary: Atualizar filtro de palavras (agentes)
      description: |-
        Atualiza filtro de palavras conforme os dados enviados.
      operationId: putV4WordFilterAgentsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              word: "proibida"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Admin]
      summary: Remover filtro de palavras (agentes)
      description: |-
        Remove filtro de palavras identificado no caminho.
      operationId: deleteV4WordFilterAgentsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/wordFilter/agents/upload:
    post:
      tags: [Admin]
      summary: Upload de filtro de palavras (agentes)
      description: |-
        Processa a solicitação de upload de filtro de palavras e retorna o resultado.
      operationId: postV4WordFilterAgentsUpload
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
            example:
              file: "<arquivo>"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/wordFilter/contacts:
    get:
      tags: [Admin]
      summary: Listar filtro de palavras (contatos)
      description: |-
        Retorna filtro de palavras conforme filtros enviados.
      operationId: getV4WordFilterContacts
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Admin]
      summary: Adicionar filtro de palavras (contatos)
      description: |-
        Adiciona filtro de palavras conforme os dados enviados.
      operationId: postV4WordFilterContacts
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              word: "proibida"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/wordFilter/contacts/{id}:
    put:
      tags: [Admin]
      summary: Atualizar filtro de palavras (contatos)
      description: |-
        Atualiza filtro de palavras conforme os dados enviados.
      operationId: putV4WordFilterContactsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              word: "proibida"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Admin]
      summary: Remover filtro de palavras (contatos)
      description: |-
        Remove filtro de palavras identificado no caminho.
      operationId: deleteV4WordFilterContactsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/wordFilter/contacts/upload:
    post:
      tags: [Admin]
      summary: Upload de filtro de palavras (contatos)
      description: |-
        Processa a solicitação de upload de filtro de palavras e retorna o resultado.
      operationId: postV4WordFilterContactsUpload
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
            example:
              file: "<arquivo>"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/timeGroup:
    get:
      tags: [Admin]
      summary: Listar grupos de horário
      description: |-
        Retorna grupos de horário conforme filtros enviados.
      operationId: getV4TimeGroup
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Admin]
      summary: Criar grupo de horário
      description: |-
        Cria grupo de horário com os dados enviados.
      operationId: postV4TimeGroup
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Horário Comercial"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/timeGroup/{id}:
    put:
      tags: [Admin]
      summary: Atualizar grupo de horário
      description: |-
        Atualiza grupo de horário conforme os dados enviados.
      operationId: putV4TimeGroupById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Horário Especial"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Admin]
      summary: Remover grupo de horário
      description: |-
        Remove grupo de horário identificado no caminho.
      operationId: deleteV4TimeGroupById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/userGroup:
    get:
      tags: [Admin]
      summary: Listar grupos de usuários
      description: |-
        Retorna grupos de usuários conforme filtros enviados.
      operationId: getV4UserGroup
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Admin]
      summary: Criar grupo de usuários
      description: |-
        Cria grupo de usuários com os dados enviados.
      operationId: postV4UserGroup
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Supervisores"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/userGroup/{id}:
    put:
      tags: [Admin]
      summary: Atualizar grupo de usuários
      description: |-
        Atualiza grupo de usuários conforme os dados enviados.
      operationId: putV4UserGroupById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Operadores"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Admin]
      summary: Remover grupo de usuários
      description: |-
        Remove grupo de usuários identificado no caminho.
      operationId: deleteV4UserGroupById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/userGroup/rules:
    get:
      tags: [Admin]
      summary: Listar regras de grupo de usuários
      description: |-
        Retorna regras de grupo de usuários conforme filtros enviados.
      operationId: getV4UserGroupRules
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/multichannel:
    get:
      tags: [Admin]
      summary: Listar multicanais
      description: |-
        Retorna multicanais conforme filtros enviados.
      operationId: getV4Multichannel
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Admin]
      summary: Criar multicanal
      description: |-
        Cria multicanal com os dados enviados.
      operationId: postV4Multichannel
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Canal X"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/multichannel/{id}:
    put:
      tags: [Admin]
      summary: Atualizar multicanal
      description: |-
        Atualiza multicanal conforme os dados enviados.
      operationId: putV4MultichannelById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Canal X2"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Admin]
      summary: Remover multicanal
      description: |-
        Remove multicanal identificado no caminho.
      operationId: deleteV4MultichannelById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/pauses:
    get:
      tags: [Admin]
      summary: Listar pausas
      description: |-
        Retorna pausas conforme filtros enviados.
      operationId: getV4Pauses
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Admin]
      summary: Criar pausa
      description: |-
        Cria pausa com os dados enviados.
      operationId: postV4Pauses
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Almoço"
              limit: 60
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/pauses/{id}:
    put:
      tags: [Admin]
      summary: Atualizar pausa
      description: |-
        Atualiza pausa conforme os dados enviados.
      operationId: putV4PausesById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Pausa curta"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Admin]
      summary: Remover pausa
      description: |-
        Remove pausa identificado no caminho.
      operationId: deleteV4PausesById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/agents:
    get:
      tags: [Agents]
      summary: Listar agentes
      description: |-
        Retorna agentes conforme filtros enviados.
      operationId: getV4Agents
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Agents]
      summary: Criar agente
      description: |-
        Cria agente com os dados enviados.
      operationId: postV4Agents
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Agente Novo"
              email: "novo@example.com"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/agents/email/{email}:
    get:
      tags: [Agents]
      summary: Buscar agente por e-mail
      description: |-
        Pesquisa agente por e-mail conforme critérios enviados.
      operationId: getV4AgentsByEmail
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: email
          required: true
          schema:
            type: string
            format: email
          example: "agent@example.com"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '404':
          $ref: '#/components/responses/NotFound'
  /v4/agents/summary:
    get:
      tags: [Agents]
      summary: Resumo de agentes
      description: |-
        Processa a solicitação de resumo de agentes e retorna o resultado.
      operationId: getV4AgentsSummary
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/agents/{id}:
    get:
      tags: [Agents]
      summary: Detalhar agente
      description: |-
        Recupera os dados de agente identificado no caminho.
      operationId: getV4AgentsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "agent_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    put:
      tags: [Agents]
      summary: Atualizar agente
      description: |-
        Atualiza agente conforme os dados enviados.
      operationId: putV4AgentsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Agente Atualizado"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Agents]
      summary: Remover agente
      description: |-
        Remove agente identificado no caminho.
      operationId: deleteV4AgentsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/agents/photo:
    post:
      tags: [Agents]
      summary: Atualizar foto do agente
      description: |-
        Atualiza foto do agente conforme os dados enviados.
      operationId: postV4AgentsPhoto
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                photo:
                  type: string
                  format: binary
            example:
              photo: "<arquivo>"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/campaigns:
    get:
      tags: [Campaigns]
      summary: Listar campanhas
      description: |-
        Retorna campanhas conforme filtros enviados.
      operationId: getV4Campaigns
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Campaigns]
      summary: Criar campanha
      description: |-
        Cria campanha com os dados enviados.
      operationId: postV4Campaigns
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Campanha 1"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/campaigns/{id}:
    get:
      tags: [Campaigns]
      summary: Detalhar campanha
      description: |-
        Recupera os dados de campanha identificado no caminho.
      operationId: getV4CampaignsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "camp_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    put:
      tags: [Campaigns]
      summary: Atualizar campanha
      description: |-
        Atualiza campanha conforme os dados enviados.
      operationId: putV4CampaignsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Campanha Atualizada"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Campaigns]
      summary: Remover campanha
      description: |-
        Remove campanha identificado no caminho.
      operationId: deleteV4CampaignsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/campaigns/filterByIds:
    post:
      tags: [Campaigns]
      summary: Filtrar campanhas por IDs
      description: |-
        Processa a solicitação de filtrar campanhas por IDs e retorna o resultado.
      operationId: postV4CampaignsFilterByIds
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FilterCampaignsByIdRequest'
            example:
              campaings: ["camp_1", "camp_2"]
              paginate: true
              limit: 10
              page: 1
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/campaigns/resume/{paginate}:
    get:
      tags: [Campaigns]
      summary: Resumo de campanhas
      description: |-
        Processa a solicitação de resumo de campanhas e retorna o resultado.
      operationId: getV4CampaignsResume
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: paginate
          required: true
          schema:
            type: string
          example: "true"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/predefined_messages:
    get:
      tags: [Messages]
      summary: Listar mensagens predefinidas
      description: |-
        Retorna mensagens predefinidas conforme filtros enviados.
      operationId: getV4PredefinedMessages
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Messages]
      summary: Criar mensagem predefinida
      description: |-
        Cria mensagem predefinida com os dados enviados.
      operationId: postV4PredefinedMessages
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PredefinedMessagesRequest'
            example:
              description: "Boas-vindas"
              message:
                - message: "Olá!"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/predefined_messages/{id}:
    get:
      tags: [Messages]
      summary: Detalhar mensagem predefinida
      description: |-
        Recupera os dados de mensagem predefinida identificado no caminho.
      operationId: getV4PredefinedMessagesById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "pm_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    put:
      tags: [Messages]
      summary: Atualizar mensagem predefinida
      description: |-
        Atualiza mensagem predefinida conforme os dados enviados.
      operationId: putV4PredefinedMessagesById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PredefinedMessagesRequest'
            example:
              description: "Boas-vindas"
              message:
                - message: "Olá!"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Messages]
      summary: Remover mensagem predefinida
      description: |-
        Remove mensagem predefinida identificado no caminho.
      operationId: deleteV4PredefinedMessagesById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '204':
          description: Removido.
        '404':
          $ref: '#/components/responses/NotFound'
  /v4/predefined_messages/by_campaigns:
    post:
      tags: [Messages]
      summary: Buscar por campanhas
      description: |-
        Pesquisa por campanhas conforme critérios enviados.
      operationId: postV4PredefinedMessagesByCampaigns
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FindPredefinedMessagesByCampaignsRequest'
            example:
              campaigns: ["camp_1"]
              order_by: "description"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/groups:
    get:
      tags: [Contacts]
      summary: Listar grupos de contatos
      description: |-
        Retorna grupos de contatos conforme filtros enviados.
      operationId: getV4ContactsGroups
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Contacts]
      summary: Criar grupo de contatos
      description: |-
        Cria grupo de contatos com os dados enviados.
      operationId: postV4ContactsGroups
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "VIP"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/groups/{id}:
    get:
      tags: [Contacts]
      summary: Detalhar grupo de contatos
      description: |-
        Recupera os dados de grupo de contatos identificado no caminho.
      operationId: getV4ContactsGroupsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "group_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    put:
      tags: [Contacts]
      summary: Atualizar grupo de contatos
      description: |-
        Atualiza grupo de contatos conforme os dados enviados.
      operationId: putV4ContactsGroupsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "VIP"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Contacts]
      summary: Remover grupo de contatos
      description: |-
        Remove grupo de contatos identificado no caminho.
      operationId: deleteV4ContactsGroupsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/groups/contact/{contact_id}:
    get:
      tags: [Contacts]
      summary: Listar grupos do contato
      description: |-
        Retorna grupos do contato conforme filtros enviados.
      operationId: getV4ContactsGroupsByContact
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: contact_id
          required: true
          schema:
            type: string
          example: "contact_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/fields:
    get:
      tags: [Contacts]
      summary: Listar campos adicionais de contato
      description: |-
        Retorna campos adicionais de contato conforme filtros enviados.
      operationId: getV4ContactsFields
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Contacts]
      summary: Criar campo adicional de contato
      description: |-
        Cria campo adicional de contato com os dados enviados.
      operationId: postV4ContactsFields
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Empresa"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/fields/{id}:
    put:
      tags: [Contacts]
      summary: Atualizar campo adicional de contato
      description: |-
        Atualiza campo adicional de contato conforme os dados enviados.
      operationId: putV4ContactsFieldsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Empresa"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Contacts]
      summary: Remover campo adicional de contato
      description: |-
        Remove campo adicional de contato identificado no caminho.
      operationId: deleteV4ContactsFieldsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/search:
    get:
      tags: [Contacts]
      summary: Pesquisar contatos
      description: |-
        Processa a solicitação de pesquisar contatos e retorna o resultado.
      operationId: getV4ContactsSearch
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: query
          schema:
            type: string
          example: "Maria"
        - in: query
          name: limit
          schema:
            type: string
            enum: [true, false, "1", "0"]
          example: "true"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/recents:
    get:
      tags: [Contacts]
      summary: Contatos recentes
      description: |-
        Processa a solicitação de contatos recentes e retorna o resultado.
      operationId: getV4ContactsRecents
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: search
          schema:
            type: string
          example: "Jo"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts:
    get:
      tags: [Contacts]
      summary: Listar contatos
      description: |-
        Retorna contatos conforme filtros enviados.
      operationId: getV4Contacts
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: name
          schema:
            type: string
        - in: query
          name: email
          schema:
            type: string
        - in: query
          name: platform
          schema:
            type: string
        - in: query
          name: platform_id
          schema:
            type: string
        - in: query
          name: start_created_at
          schema:
            type: string
            format: date
        - in: query
          name: end_created_at
          schema:
            type: string
            format: date
        - in: query
          name: updated_at
          schema:
            type: string
            format: date
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Contacts]
      summary: Criar contato
      description: |-
        Cria contato com os dados enviados.
      operationId: postV4Contacts
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactsAPIRequest'
            example:
              name: "Maria"
              Whatsapp: "558899999999"
              email: "maria@example.com"
      responses:
        '201':
          $ref: '#/components/responses/GenericSuccess'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '500':
          $ref: '#/components/responses/ServerError'
  /v4/contacts/{id}:
    get:
      tags: [Contacts]
      summary: Detalhar contato
      description: |-
        Recupera os dados de contato identificado no caminho.
      operationId: getV4ContactsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "contact_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags: [Contacts]
      summary: Atualizar contato
      description: |-
        Atualiza os dados cadastrais do contato.
      operationId: putV4ContactsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactsAPIRequest'
            example:
              name: "Maria"
              email: "maria@example.com"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
    delete:
      tags: [Contacts]
      summary: Remover contato
      description: |-
        Remove contato identificado no caminho.
      operationId: deleteV4ContactsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/contacts/annotation:
    post:
      tags: [Contacts]
      summary: Salvar anotação do contato
      description: |-
        Processa a solicitação de salvar anotação do contato e retorna o resultado.
      operationId: postV4ContactsAnnotation
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactAnnotationRequest'
            example:
              _id: "contact_123"
              observation: "Contato VIP"
              agent_id: "agent_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '404':
          $ref: '#/components/responses/NotFound'
  /v4/contacts/update_fields/{id}:
    put:
      tags: [Contacts]
      summary: Atualizar campos adicionais do contato
      description: |-
        Atualiza campos adicionais do contato conforme os dados enviados.
      operationId: putV4ContactsUpdateFields
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties:
                type: string
            example:
              custom_field_1: "valor"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '400':
          $ref: '#/components/responses/BadRequest'
  /v4/contacts/{id}/attendances:
    get:
      tags: [Contacts]
      summary: Listar atendimentos do contato
      description: |-
        Retorna atendimentos do contato conforme filtros enviados.
      operationId: getV4ContactsAttendances
      security:
        - JwtAuth: []
      parameters:
        - in: query
          name: platform
          required: true
          schema:
            type: string
          example: Whatsapp
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "contact_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '404':
          $ref: '#/components/responses/NotFound'
  /v4/tabulations:
    get:
      tags: [Tabulations]
      summary: Listar tabulações
      description: |-
        Retorna tabulações conforme filtros enviados.
      operationId: getV4Tabulations
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    post:
      tags: [Tabulations]
      summary: Criar tabulação
      description: |-
        Cria tabulação com os dados enviados.
      operationId: postV4Tabulations
      security:
        - JwtAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Encerramento"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/tabulations/{id}:
    put:
      tags: [Tabulations]
      summary: Atualizar tabulação
      description: |-
        Atualiza tabulação conforme os dados enviados.
      operationId: putV4TabulationsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Encerramento 2"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
    delete:
      tags: [Tabulations]
      summary: Remover tabulação
      description: |-
        Remove tabulação identificado no caminho.
      operationId: deleteV4TabulationsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/channels/platforms:
    get:
      tags: [Channels]
      summary: Listar plataformas
      description: |-
        Retorna plataformas conforme filtros enviados.
      operationId: getV4ChannelsPlatforms
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/channels/platforms/active:
    get:
      tags: [Channels]
      summary: Listar plataformas com canais ativos
      description: |-
        Retorna plataformas com canais ativos conforme filtros enviados.
      operationId: getV4ChannelsPlatformsActive
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/channels:
    get:
      tags: [Channels]
      summary: Listar canais
      description: |-
        Retorna canais conforme filtros enviados.
      operationId: getV4Channels
      security:
        - JwtAuth: []
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/channels/{id}:
    get:
      tags: [Channels]
      summary: Detalhar canal
      description: |-
        Recupera os dados de canal identificado no caminho.
      operationId: getV4ChannelsById
      security:
        - JwtAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "channel_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/push/subscribe:
    post:
      tags: [WebChat]
      summary: Inscrever push
      description: |-
        Processa a solicitação de inscrever push e retorna o resultado.
      operationId: postV4WebchatPushSubscribe
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
          description: ID do canal WebChat.
          example: "channel_123"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              endpoint: "https://push.example.com"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/push/subscribe/delete:
    post:
      tags: [WebChat]
      summary: Remover inscrição push
      description: |-
        Remove inscrição push identificado no caminho.
      operationId: postV4WebchatPushUnsubscribe
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
          example: "channel_123"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              endpoint: "https://push.example.com"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/manifest.json:
    get:
      tags: [WebChat]
      summary: Manifest do canal
      description: |-
        Processa a solicitação de manifest do canal e retorna o resultado.
      operationId: getV4WebchatManifest
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
          example: "channel_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/configuration:
    get:
      tags: [WebChat]
      summary: Configuração do canal
      description: |-
        Processa a solicitação de configuração do canal e retorna o resultado.
      operationId: getV4WebchatConfiguration
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
          example: "channel_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/session-exists:
    get:
      tags: [WebChat]
      summary: Verificar sessão existente
      description: |-
        Verifica sessão existente e retorna o estado atual.
      operationId: getV4WebchatSessionExists
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
          example: "channel_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/messages:
    get:
      tags: [WebChat]
      summary: Listar mensagens do WebChat
      description: |-
        Retorna mensagens do WebChat conforme filtros enviados.
      operationId: getV4WebchatMessages
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
          example: "channel_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/session-create:
    post:
      tags: [WebChat]
      summary: Criar sessão WebChat
      description: |-
        Cria sessão WebChat com os dados enviados.
      operationId: postV4WebchatSessionCreate
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
          example: "channel_123"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              name: "Visitante"
              email: "visitante@example.com"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/session-finish:
    post:
      tags: [WebChat]
      summary: Finalizar sessão WebChat
      description: |-
        Finaliza sessão WebChat conforme a sessão informada.
      operationId: postV4WebchatSessionFinish
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
          example: "channel_123"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/session-update:
    patch:
      tags: [WebChat]
      summary: Atualizar sessão WebChat
      description: |-
        Atualiza sessão WebChat conforme os dados enviados.
      operationId: patchV4WebchatSessionUpdate
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
          example: "channel_123"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              session_id: "session_123"
              name: "Visitante"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/flow-restart:
    post:
      tags: [WebChat]
      summary: Reiniciar fluxo
      description: |-
        Reinicia fluxo no contexto do canal informado.
      operationId: postV4WebchatFlowRestart
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/flow-autoStart:
    post:
      tags: [WebChat]
      summary: Auto iniciar fluxo
      description: |-
        Aciona o auto início de fluxo para o canal informado.
      operationId: postV4WebchatFlowAutoStart
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/flow-finish:
    delete:
      tags: [WebChat]
      summary: Finalizar fluxo
      description: |-
        Finaliza fluxo conforme a sessão informada.
      operationId: deleteV4WebchatFlowFinish
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/webchat/{channel}/simulator-finish:
    post:
      tags: [WebChat]
      summary: Encerrar simulador de fluxo
      description: |-
        Encerra simulador de fluxo conforme a sessão informada.
      operationId: postV4WebchatSimulatorFinish
      parameters:
        - in: path
          name: channel
          required: true
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              session_id: "session_123"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/rdstation/send/{token}/{id}:
    get:
      tags: [Rdstation]
      summary: Enviar mensagem RD Station (GET)
      description: |-
        O token é validado via rota (path).
      operationId: getV4RdstationSend
      parameters:
        - in: path
          name: token
          required: true
          schema:
            type: string
          example: "token_rd"
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "rd_123"
      responses:
        '200':
          $ref: '#/components/responses/MessageSendSuccess'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags: [Rdstation]
      summary: Enviar mensagem RD Station (POST)
      description: |-
        O token é validado via rota (path).
      operationId: postV4RdstationSend
      parameters:
        - in: path
          name: token
          required: true
          schema:
            type: string
          example: "token_rd"
        - in: path
          name: id
          required: true
          schema:
            type: string
          example: "rd_123"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
            example:
              platform_id: "platform_123"
              channel_id: "channel_123"
              type: "text"
              message: "Olá"
      responses:
        '200':
          $ref: '#/components/responses/MessageSendSuccess'
        '403':
          $ref: '#/components/responses/Forbidden'
  /v4/remote-auth-idps:
    get:
      tags: [Auth]
      summary: Listar IDPs remotos
      description: |-
        Retorna iDPs remotos conforme filtros enviados.
      operationId: getV4RemoteAuthIdps
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/config-application:
    get:
      tags: [Admin]
      summary: Obter configuração pública da aplicação
      description: |-
        Recupera configuração pública da aplicação.
      operationId: getV4ConfigApplication
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/unlock_for_trust:
    post:
      tags: [Auth]
      summary: Desbloquear por confiança
      description: |-
        Libera por confiança após validação dos dados enviados.
      operationId: postV4UnlockForTrust
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              email: "user@example.com"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
  /v4/generic/messages/send:
    post:
      tags: [Messages]
      summary: Enviar mensagem em canal genérico
      description: |-
        Envia mensagem em canal genérico com os dados informados.
      operationId: postV4GenericMessagesSend
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              platform_id: "platform_123"
              channel_id: "channel_123"
              message: "Olá"
      responses:
        '200':
          $ref: '#/components/responses/MessageSendSuccess'
        '422':
          $ref: '#/components/responses/ValidationError'
  /v4/fortics-bsp/update-api-key:
    post:
      tags: [Admin]
      summary: Atualizar API key
      description: |-
        Atualiza aPI key conforme os dados enviados.
      operationId: postV4ForticsBspUpdateApiKey
      security:
        - ForticsIntegrationKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              api_key: "nova_key"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v4/fortics-bsp/whitelabel:
    post:
      tags: [Admin]
      summary: Obter whitelabel
      description: |-
        Recupera whitelabel.
      operationId: postV4ForticsBspWhitelabel
      security:
        - ForticsIntegrationKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              domain: "empresa.com"
      responses:
        '200':
          $ref: '#/components/responses/GenericSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  securitySchemes:
    JwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Token JWT no header Authorization.
    ApiTokenQuery:
      type: apiKey
      in: query
      name: token
      description: Token simples enviado por query.
    GenericChannelApiKey:
      type: apiKey
      in: header
      name: API-KEY
      description: Chave do canal genérico no header API-KEY.
    IntegrationApiKey:
      type: apiKey
      in: header
      name: apiKey
      description: Chave do canal para integrações WhatsApp attendances.
    ForticsIntegrationKey:
      type: apiKey
      in: header
      name: Integration-Key
      description: Chave de integração Fortics BSP.
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
        status:
          type: boolean
        code:
          type: string
      example:
        error: "Unauthorized"
    ValidationErrorResponse:
      type: object
      properties:
        status:
          type: boolean
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
      example:
        status: false
        errors:
          email: ["O campo email é obrigatório."]
    GenericSuccessResponse:
      type: object
      additionalProperties: true
      example:
        status: true
        message: "Sucesso"
    AuthLoginRequest:
      type: object
      required: [email, password]
      properties:
        email:
          type: string
          description: E-mail do usuário.
        password:
          type: string
          description: Senha do usuário.
        device_token:
          type: string
        accept_token_service:
          type: boolean
        is_contact_center:
          type: boolean
    AuthMeResponse:
      type: object
      properties:
        _id:
          type: string
        email:
          type: string
        name:
          type: string
        session_agent:
          type: object
          nullable: true
        keep_alive:
          type: integer
    SessionInitRequest:
      type: object
      required: [contact_id, platform, channel_id, attendance, agent_id, agent_name]
      properties:
        contact_id:
          type: string
        platform:
          type: string
        channel_id:
          type: string
        attendance:
          type: string
        agent_id:
          type: string
        agent_name:
          type: string
    SendMessageRequest:
      type: object
      required: [platform_id, channel_id, type]
      properties:
        contact_name:
          type: string
        platform_id:
          type: string
        channel_id:
          type: string
        agent_id:
          type: string
        type:
          type: string
          enum: [text, media]
        message:
          type: string
        file:
          type: string
        legend:
          type: string
        close_session:
          type: integer
          enum: [0, 1, 2, 3]
        agent:
          type: string
          format: email
        attendance_id:
          type: string
        is_hsm:
          type: boolean
        hsm_template_name:
          type: string
        hsm_placeholders:
          type: array
          items:
            type: string
        contact_variables:
          type: object
          additionalProperties: true
        gateway:
          type: string
        start_conversation:
          type: boolean
        subject:
          type: string
        session_data:
          type: object
          additionalProperties: true
        user_data:
          type: object
          additionalProperties: true
        contact_data:
          type: object
          additionalProperties: true
        context_id:
          type: string
        attachments:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              preview:
                type: string
    MessageReadRequest:
      type: object
      required: [platform_id, channel_id]
      properties:
        platform_id:
          type: string
        channel_id:
          type: string
    AnnotationMessageRequest:
      type: object
      required: [annotation]
      properties:
        annotation:
          type: string
          maxLength: 255
    UpdateAgentRequest:
      type: object
      properties:
        name:
          type: string
        ramal:
          type: integer
        password:
          type: string
        new_password:
          type: string
        default_language:
          type: string
    SetTagCategoryRequest:
      type: object
      required: [session_id, tag_id]
      properties:
        session_id:
          type: string
        tag_id:
          type: string
    DeleteTagCategoryRequest:
      type: object
      required: [session_id, tag_id]
      properties:
        session_id:
          type: string
        tag_id:
          type: string
    PauseStartRequest:
      type: object
      required: [pause_id]
      properties:
        pause_id:
          type: string
        isPausePersonalized:
          type: boolean
    TranslateMessageRequest:
      type: object
      required: [language, message]
      properties:
        language:
          type: string
        message:
          type: string
        session_id:
          type: string
        message_id:
          type: string
    DetectLanguageRequest:
      type: object
      required: [message, contact_id]
      properties:
        message:
          type: string
        contact_id:
          type: string
    ToggleAutoTranslateRequest:
      type: object
      required: [session_id]
      properties:
        session_id:
          type: string
    ClickToCallRequest:
      type: object
      required: [contact_id]
      properties:
        contact_id:
          type: string
        whatsapp:
          type: boolean
    AttendanceInitSessionRequest:
      type: object
      properties:
        contact_id:
          type: string
        platform:
          type: string
        channel_id:
          type: string
        team_id:
          type: string
        agent_id:
          type: string
        hsm_id:
          type: string
        tagMessage:
          type: string
        tagType:
          type: string
    TransferRequest:
      type: object
      required: [session_id, type]
      properties:
        session_id:
          type: string
        type:
          type: string
          enum: [attendance, agent]
        attendance_id:
          type: string
        agent_id:
          type: string
        transfer_wait:
          type: boolean
    FilterCampaignsByIdRequest:
      type: object
      required: [campaings]
      properties:
        campaings:
          type: array
          items:
            type: string
        paginate:
          type: boolean
        limit:
          type: integer
          minimum: 1
        page:
          type: integer
          minimum: 1
    PredefinedMessagesRequest:
      type: object
      required: [message, description]
      properties:
        message:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
        description:
          type: string
    FindPredefinedMessagesByCampaignsRequest:
      type: object
      required: [campaigns]
      properties:
        campaigns:
          type: array
          minItems: 1
          items:
            type: string
        order_by:
          type: string
          enum: [description, _id]
    ListAllHsmTemplatesRequest:
      type: object
      properties:
        attendance_id:
          type: string
        channel_id:
          type: string
    ContactsAPIRequest:
      type: object
      properties:
        name:
          type: string
        email:
          type: string
        number:
          type: integer
        group:
          type: array
          items:
            type: string
        groups:
          type: array
          items:
            type: string
        Whatsapp:
          type: string
        Instagram:
          type: string
        Telegram:
          type: string
        Messenger:
          type: string
        InstagramDirect:
          type: string
        GoogleChat:
          type: string
        ChatWeb:
          type: string
        Email:
          type: string
        MercadoLivre:
          type: string
        WhatsappBusiness:
          type: string
        Signal:
          type: string
        SMS:
          type: string
        ddi:
          type: integer
        default_language:
          type: string
        final_number:
          type: integer
        opt_in:
          type: string
        optin_gupshup:
          type: boolean
    ContactAnnotationRequest:
      type: object
      required: [_id, agent_id]
      properties:
        _id:
          type: string
        observation:
          type: string
          nullable: true
        agent_id:
          type: string
    ApplicationAttendanceRequest:
      type: object
      properties:
        initial_grade:
          type: number
        final_grade:
          type: number
  responses:
    GenericSuccess:
      description: Sucesso.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericSuccessResponse'
          example:
            status: true
            message: "Sucesso"
    AuthLoginSuccess:
      description: Login realizado.
      content:
        application/json:
          schema:
            type: object
            properties:
              token:
                type: string
              user:
                type: object
                additionalProperties: true
            example:
              token: "jwt.token"
              user:
                _id: "user_123"
                email: "agent@example.com"
    MessageSendSuccess:
      description: Mensagem enviada.
      content:
        application/json:
          schema:
            type: object
            additionalProperties: true
          example:
            message: "Mensagem enviada"
            session_id: "session_123"
    Unauthorized:
      description: Não autorizado.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: "Unauthorized"
    Forbidden:
      description: Proibido.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: "Forbidden"
    NotFound:
      description: Não encontrado.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: "Not found"
    ValidationError:
      description: Erro de validação.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
          example:
            status: false
            errors:
              field: ["O campo field é obrigatório."]
    BadRequest:
      description: Requisição inválida.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: "Bad request"
    Conflict:
      description: Conflito de negócio.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: "Conflito"
    PreconditionFailed:
      description: Pré-condição falhou.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: "Pré-condição falhou"
    ServerError:
      description: Erro interno.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: "internal server error"
