openapi: 3.0.0
info:
  title: API RecargaEV - Plataforma de Recarga de Veículos Elétricos
  description: |
    API RESTful para gerenciamento de estações de recarga de veículos elétricos.
    
    ## Autenticação
    A API utiliza autenticação por sessão via token no header:
    `Authorization: {session_id}`
    
    As sessões são obtidas através dos endpoints de login:
    - `/adm/login` - Login para administradores
    - `/usr/login` - Login para usuários comuns
    
    ## Subdomínios
    A API opera com subdomínios no formato: `{empresa}.api.{domain_base}`
    Cada empresa tem seu próprio subdomínio que define o contexto de dados.
    
    ## Ambientes
    - **Produção**: `https://{empresa}.api.recargaev.com.br`
    - **Homologação**: `https://{empresa}.api-homol.recargaev.com.br`
    - **Desenvolvimento**: `http://localhost:8000` (subdomínio padrão 'default')
    
    ## Paginação
    Endpoints que retornam listas utilizam paginação via URL:
    - `/{endpoint}/{aba}` onde `aba` é o número da página (1-indexed)
    - Resposta no formato: `{ "Info": { "Abas": total, "Aba_Atual": atual, "Quantidade": total_itens }, "Values": [...] }`
    
  version: 2.0.0
  contact:
    name: Suporte RecargaEV
    email: suporte@recargaev.com.br

servers:
  - url: https://ds-recargaev.api.recargaev.com.br
    description: Servidor de Produção
  - url: http://localhost:8000
    description: Servidor de Desenvolvimento Local

tags:
  - name: Health
    description: Endpoints de verificação de saúde do sistema
  - name: Autenticação
    description: Login e logout de usuários
  - name: Dashboard
    description: Dashboard e informações gerais
  - name: Contas (Accounts)
    description: Gerenciamento de contas empresariais
  - name: Grupos de Usuários
    description: Gerenciamento de grupos/perfis de usuários
  - name: Grupos de Estações
    description: Gerenciamento de grupos de estações
  - name: Usuários
    description: Gerenciamento de usuários do sistema
  - name: Estações
    description: Gerenciamento de estações de recarga
  - name: Tags
    description: Gerenciamento de tags RFID de autenticação
  - name: Perfis de Preço
    description: Configuração de perfis de preço e tarifas
  - name: Perfis Dinâmicos
    description: Configuração de perfis de preço dinâmicos
  - name: Transações
    description: Histórico de transações de recarga
  - name: Transações Financeiras
    description: Histórico de transações financeiras
  - name: Eventos
    description: Eventos e alertas do sistema
  - name: Relatórios
    description: Geração de relatórios e análises
  - name: Comandos OCPP
    description: Envio de comandos para estações OCPP
  - name: Pagamentos
    description: Processamento de pagamentos via PIX e Cartão
  - name: Mercado Pago
    description: Integração com gateway Mercado Pago
  - name: NFS-e
    description: Emissão de Notas Fiscais de Serviço Eletrônicas
  - name: Logs
    description: Download de logs do sistema
  - name: Usuário Final
    description: Endpoints para usuários finais (app mobile)
  - name: Debug
    description: Endpoints para diagnóstico e testes

components:
  securitySchemes:
    sessionAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Token de sessão obtido no login (UUID)
  
  schemas:
    # ==================== RESPOSTAS PADRÃO ====================
    ErrorResponse:
      type: object
      properties:
        Status:
          type: string
          example: "Mensagem de erro"
    
    SuccessResponse:
      type: object
      properties:
        Status:
          type: string
          example: "OK"
    
    PaginatedResponse:
      type: object
      properties:
        Info:
          type: object
          properties:
            Abas:
              type: integer
              example: 5
            Aba_Atual:
              type: integer
              example: 1
            Quantidade:
              type: integer
              example: 42
        Values:
          type: array
          items:
            type: object
    
    # ==================== AUTENTICAÇÃO ====================
    LoginRequest:
      type: object
      required:
        - User
        - Password
      properties:
        User:
          type: string
          example: "admin@empresa.com"
        Password:
          type: string
          example: "Senha@123"
    
    LoginResponse:
      type: object
      properties:
        User:
          type: string
        Login_Id:
          type: string
    
    # ==================== DASHBOARD ====================
    DashboardResponse:
      type: object
      properties:
        QTD_STATIONS:
          type: integer
        TOTYAL_ONLINE:
          type: integer
        QTD_USERS:
          type: integer
        REVENUE_TODAY:
          type: number
        REVENUE_MONTH:
          type: number
    
    # ==================== CONTAS ====================
    AccountCreate:
      type: object
      required:
        - NAME
        - CPF/CNPJ
      properties:
        NAME:
          type: string
        CPF/CNPJ:
          type: string
        BANK_ACCOUNT:
          type: string
        ADDRESS:
          type: string
        ACCOUNT_STATUS:
          type: string
          enum: [active, inactive, suspended]
        ACCOUNT_LEVEL:
          type: integer
        LOGO:
          type: string
          format: binary
    
    AccountResponse:
      type: object
      properties:
        ID:
          type: integer
        NAME:
          type: string
        CPF/CNPJ:
          type: string
        LOGO:
          type: string
        SUBDOMAIN:
          type: string
        ACCOUNT_STATUS:
          type: string
        ACCOUNT_LEVEL:
          type: integer
    
    AccountUpdate:
      type: object
      properties:
        NAME:
          type: string
        CPF/CNPJ:
          type: string
        ADDRESS:
          type: string
        ACCOUNT_STATUS:
          type: string
        LOGO:
          type: string
          format: binary
    
    # ==================== GRUPOS DE USUÁRIOS ====================
    UserGroupCreate:
      type: object
      required:
        - NAME
        - TYPE
      properties:
        NAME:
          type: string
        TYPE:
          type: string
          enum: [ADM, USER]
        AUTHORIZATION:
          type: object
        ACCOUNT:
          type: integer
    
    UserGroupUpdate:
      type: object
      properties:
        NAME:
          type: string
        TYPE:
          type: string
          enum: [ADM, USER]
        AUTHORIZATION:
          type: object
        ACCOUNT:
          type: integer
    
    UserGroupResponse:
      type: object
      properties:
        ID:
          type: integer
        NAME:
          type: string
        TYPE:
          type: string
        ACCOUNT:
          type: integer
    
    # ==================== GRUPOS DE ESTAÇÕES ====================
    StationGroupCreate:
      type: object
      required:
        - NAME
      properties:
        NAME:
          type: string
        ACCOUNT:
          type: integer
        EXTERNAL_ID:
          type: string
        STREET:
          type: string
        NUMBER:
          type: string
        CEP:
          type: string
        CITY:
          type: string
        UF:
          type: string
        COUNTRY:
          type: string
        LATITUDE:
          type: string
        LONGITUDE:
          type: string
        PHOTO:
          type: string
          format: binary
    
    StationGroupUpdate:
      type: object
      properties:
        NAME:
          type: string
        ACCOUNT:
          type: integer
        STREET:
          type: string
        NUMBER:
          type: string
        CEP:
          type: string
        CITY:
          type: string
        UF:
          type: string
        PHOTO:
          type: string
          format: binary
    
    StationGroupResponse:
      type: object
      properties:
        ID:
          type: integer
        NAME:
          type: string
        ACCOUNT:
          type: integer
        STREET:
          type: string
        CITY:
          type: string
        UF:
          type: string
        PHOTO:
          type: string
    
    # ==================== USUÁRIOS ====================
    UserCreate:
      type: object
      required:
        - NAME
        - DOCUMENT
        - EMAIL
        - PASSWORD
      properties:
        NAME:
          type: string
        DOCUMENT:
          type: string
        EMAIL:
          type: string
          format: email
        PASSWORD:
          type: string
        PHONE:
          type: string
        VEHICLE:
          type: string
        ACCOUNT:
          type: integer
        USER_GROUP:
          type: integer
        TAGS:
          type: array
          items:
            type: string
    
    UserUpdate:
      type: object
      properties:
        NAME:
          type: string
        EMAIL:
          type: string
        PHONE:
          type: string
        VEHICLE:
          type: string
        PASSWORD:
          type: string
        TAGS:
          type: array
          items:
            type: string
        CEP:
          type: string
        STREET:
          type: string
        NUMBER:
          type: string
        COMPLEMENT:
          type: string
        NEIGHBORHOOD:
          type: string
        CITY:
          type: string
        STATE:
          type: string
    
    UserResponse:
      type: object
      properties:
        ID:
          type: integer
        NAME:
          type: string
        EMAIL:
          type: string
        DOCUMENT:
          type: string
        OCPP_TAG_ID:
          type: string
        BALANCE:
          type: number
        ONLINE:
          type: boolean
        ACCOUNT:
          type: integer
        TRANSACTIONS_LAST28:
          type: object
    
    # ==================== ESTAÇÕES ====================
    StationCreate:
      type: object
      required:
        - DESCRIPTION
        - CHARGE_POINT_ID
      properties:
        DESCRIPTION:
          type: string
        CHARGE_POINT_ID:
          type: string
        ACCOUNT:
          type: integer
        STATIONGROUP:
          type: integer
        TYPE:
          type: string
          enum: [public, private]
        PAYMENT_METHOD:
          type: string
          enum: [prepaid, postpaid, free]
        PRICE_PER_KWH:
          type: number
        MAX_POWER:
          type: number
    
    StationUpdate:
      type: object
      properties:
        DESCRIPTION:
          type: string
        STATIONGROUP:
          type: integer
        TYPE:
          type: string
        PAYMENT_METHOD:
          type: string
        PRICE_PER_KWH:
          type: number
        ENABLE:
          type: boolean
        IMAGES:
          type: array
          items:
            type: string
            format: binary
    
    StationResponse:
      type: object
      properties:
        ID:
          type: integer
        CHARGE_POINT_ID:
          type: string
        DESCRIPTION:
          type: string
        ONLINE:
          type: boolean
        STATUS:
          type: string
        QTD_CONNECTORS:
          type: integer
        CONNECTORS:
          type: array
          items:
            $ref: '#/components/schemas/Connector'
        CONNECTORS_STATUS:
          type: array
          items:
            type: object
        EVENT:
          type: array
          items:
            type: object
        TRANSACTIONS:
          type: array
          items:
            type: object
        TRANSACTIONS_LAST28:
          type: object
        CALCULATED_STATUS:
          type: string
          enum: [ONLINE, OFFLINE, FAULT]
        IMAGES:
          type: array
          items:
            type: object
    
    Connector:
      type: object
      properties:
        CONNECTOR_ID:
          type: integer
        STATUS:
          type: string
        TYPE:
          type: string
        MAX_POWER:
          type: number
    
    # ==================== TAGS ====================
    TagCreate:
      type: object
      required:
        - ID_TAG
      properties:
        ID_TAG:
          type: string
        TYPE:
          type: string
          enum: [USER_TAG, CARD]
        UTILIZATOR:
          type: integer
        ENABLE:
          type: boolean
    
    TagUpdate:
      type: object
      properties:
        TYPE:
          type: string
        UTILIZATOR:
          type: integer
        ENABLE:
          type: boolean
    
    TagResponse:
      type: object
      properties:
        ID:
          type: integer
        ID_TAG:
          type: string
        TYPE:
          type: string
        UTILIZATOR:
          type: integer
        ENABLE:
          type: boolean
    
    # ==================== PERFIS DE PREÇO ====================
    PriceProfileCreate:
      type: object
      required:
        - NAME
        - WEEK_DAY
        - CHARGE_POINT_IDS
      properties:
        NAME:
          type: string
        CHARGE_POINT_IDS:
          type: array
          items:
            type: string
        ACCOUNT:
          type: integer
        WEEK_DAY:
          type: string
          enum: [segunda, terca, quarta, quinta, sexta, sabado, domingo]
        DYNAMIC_PRICING:
          type: boolean
        TAX_ENABLE:
          type: boolean
        TAX:
          type: number
        INITIAL_VALUE_ENABLE:
          type: boolean
        INITIAL_VALUE:
          type: number
        OPERATIONAL_RATE_ENABLE:
          type: boolean
        OPERATIONAL_RATE:
          type: number
        KWH_COST_ENABLE:
          type: boolean
        KWH_COST:
          type: number
        PRICE_KWH:
          type: number
        CHARGE_TYPE_REVENUE:
          type: string
          enum: [kWh, time, hybrid]
    
    PriceProfileUpdate:
      type: object
      properties:
        NAME:
          type: string
        CHARGE_POINT_IDS:
          type: array
          items:
            type: string
        WEEK_DAY:
          type: string
        DYNAMIC_PRICING:
          type: boolean
        TAX_ENABLE:
          type: boolean
        TAX:
          type: number
        INITIAL_VALUE_ENABLE:
          type: boolean
        INITIAL_VALUE:
          type: number
        OPERATIONAL_RATE_ENABLE:
          type: boolean
        OPERATIONAL_RATE:
          type: number
        KWH_COST_ENABLE:
          type: boolean
        KWH_COST:
          type: number
        PRICE_KWH:
          type: number
    
    # ==================== PERFIS DINÂMICOS ====================
    DynamicProfileCreate:
      type: object
      required:
        - PRICE_PROFILE
        - START_TIME
        - STOP_TIME
      properties:
        PRICE_PROFILE:
          type: integer
        START_TIME:
          type: string
          pattern: "^([0-1][0-9]|2[0-3]):[0-5][0-9]$"
        STOP_TIME:
          type: string
          pattern: "^([0-1][0-9]|2[0-3]):[0-5][0-9]$"
        OPERATIONAL_RATE_ENABLE:
          type: boolean
        OPERATIONAL_RATE:
          type: number
        KWH_COST_ENABLE:
          type: boolean
        KWH_COST:
          type: number
        KWH_PRICE_ENABLE:
          type: boolean
        KWH_PRICE:
          type: number
    
    DynamicProfileUpdate:
      type: object
      properties:
        START_TIME:
          type: string
        STOP_TIME:
          type: string
        OPERATIONAL_RATE_ENABLE:
          type: boolean
        OPERATIONAL_RATE:
          type: number
        KWH_COST_ENABLE:
          type: boolean
        KWH_COST:
          type: number
        KWH_PRICE_ENABLE:
          type: boolean
        KWH_PRICE:
          type: number
    
    # ==================== COMANDOS OCPP ====================
    OCPPCommandRequest:
      type: object
      required:
        - CHARGEPOINTID
        - COMMAND
        - PAYLOAD
      properties:
        CHARGEPOINTID:
          type: array
          items:
            type: string
        COMMAND:
          type: string
        PAYLOAD:
          type: object
    
    UnlockConnectorCommand:
      type: object
      required:
        - CHARGEPOINTID
        - PAYLOAD
      properties:
        CHARGEPOINTID:
          type: array
          items:
            type: string
        PAYLOAD:
          type: object
          properties:
            connector_id:
              type: integer
            id_tag:
              type: string
    
    ChangeAvailabilityCommand:
      type: object
      required:
        - CHARGEPOINTID
        - PAYLOAD
      properties:
        CHARGEPOINTID:
          type: array
          items:
            type: string
        PAYLOAD:
          type: object
          properties:
            connector_id:
              type: integer
            type:
              type: string
              enum: [Operative, Inoperative]
    
    RemoteStartCommand:
      type: object
      required:
        - CHARGEPOINTID
        - PAYLOAD
      properties:
        CHARGEPOINTID:
          type: array
          items:
            type: string
        PAYLOAD:
          type: object
          properties:
            connector_id:
              type: integer
            id_tag:
              type: string
    
    RemoteStopCommand:
      type: object
      required:
        - CHARGEPOINTID
        - PAYLOAD
      properties:
        CHARGEPOINTID:
          type: array
          items:
            type: string
        PAYLOAD:
          type: object
          properties:
            transaction_id:
              type: string
    
    ResetCommand:
      type: object
      required:
        - CHARGEPOINTID
        - PAYLOAD
      properties:
        CHARGEPOINTID:
          type: array
          items:
            type: string
        PAYLOAD:
          type: object
          properties:
            type:
              type: string
              enum: [Hard, Soft]
    
    # ==================== PAGAMENTOS ====================
    PIXPaymentCreate:
      type: object
      required:
        - amount
      properties:
        amount:
          type: number
        description:
          type: string
        expiration_minutes:
          type: integer
          default: 60
    
    CardPaymentCreate:
      type: object
      required:
        - amount
        - card_token
      properties:
        amount:
          type: number
        card_token:
          type: string
        description:
          type: string
        installments:
          type: integer
          default: 1
        save_card:
          type: boolean
        payer:
          $ref: '#/components/schemas/PayerInfo'
    
    PayerInfo:
      type: object
      properties:
        name:
          type: string
        tax_id:
          type: string
        email:
          type: string
        phone_number:
          type: string
        address:
          type: object
          properties:
            street:
              type: string
            number:
              type: string
            complement:
              type: string
            city:
              type: string
            state:
              type: string
            zip_code:
              type: string
    
    # ==================== RELATÓRIOS ====================
    ReportRequest:
      type: object
      required:
        - STATIONS
        - INITIAL_DATE
        - FINAL_DATE
      properties:
        STATIONS:
          type: array
          items:
            type: string
        INITIAL_DATE:
          type: string
          format: date-time
        FINAL_DATE:
          type: string
          format: date-time
        KWH_COST:
          type: number
        KWH_REVENUE:
          type: number
    
    StationGroupReportRequest:
      type: object
      required:
        - GROUP_ID
        - MONTH
        - YEAR
      properties:
        GROUP_ID:
          type: integer
        MONTH:
          type: integer
          minimum: 1
          maximum: 12
        YEAR:
          type: integer
        GMT_OFFSET:
          type: integer
          default: -3
        KWH_COST:
          type: number
        KWH_REVENUE:
          type: number
    
    # ==================== USUÁRIO FINAL ====================
    UserStartTransactionRequest:
      type: object
      required:
        - connector_id
        - payment_method
      properties:
        connector_id:
          type: integer
        payment_method:
          type: string
          enum: [balance, credit_card]
        token:
          type: string
    
    # ==================== NFS-e ====================
    NFSeEmitirRequest:
      type: object
      required:
        - prestador_cnpj
        - tomador_razao_social
        - valor_servicos
        - discriminacao
      properties:
        prestador_cnpj:
          type: string
        inscricao_municipal:
          type: string
        tomador_cnpj:
          type: string
        tomador_cpf:
          type: string
        tomador_razao_social:
          type: string
        tomador_endereco:
          type: object
          properties:
            logradouro:
              type: string
            numero:
              type: string
            complemento:
              type: string
            bairro:
              type: string
            cidade:
              type: string
            uf:
              type: string
            cep:
              type: string
        valor_servicos:
          type: number
        aliquota_iss:
          type: number
          default: 5.0
        discriminacao:
          type: string
    
    NFSeConsultaRequest:
      type: object
      required:
        - numero_nota
        - cnpj_prestador
      properties:
        numero_nota:
          type: string
        cnpj_prestador:
          type: string
    
    NFSeCancelarRequest:
      type: object
      required:
        - numero_nota
        - motivo
      properties:
        numero_nota:
          type: string
        motivo:
          type: string
        codigo_cancelamento:
          type: integer
          default: 5

paths:
  # ==================== HEALTH ====================
  /health:
    get:
      tags:
        - Health
      summary: Verifica saúde da API
      responses:
        '200':
          description: Serviço saudável
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
        '500':
          description: Serviço não saudável
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  
  # ==================== AUTENTICAÇÃO ====================
  /adm/login:
    post:
      tags:
        - Autenticação
      summary: Login de administrador
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
      responses:
        '200':
          description: Login realizado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
        '401':
          description: Credenciais inválidas
  
  /adm/logout:
    post:
      tags:
        - Autenticação
      summary: Logout de administrador
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Logout realizado
  
  /usr/login:
    post:
      tags:
        - Autenticação
      summary: Login de usuário comum
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
      responses:
        '200':
          description: Login realizado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
  
  /usr/logout:
    post:
      tags:
        - Autenticação
      summary: Logout de usuário
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Logout realizado
  
  # ==================== DASHBOARD ====================
  /adm:
    get:
      tags:
        - Dashboard
      summary: Dashboard ADM
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Dados do dashboard
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DashboardResponse'
  
  # ==================== CONTAS ====================
  /adm/register/account:
    post:
      tags:
        - Contas (Accounts)
      summary: Registra nova conta
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/AccountCreate'
      responses:
        '200':
          description: Conta registrada
  
  /adm/update/account/{accountid}:
    patch:
      tags:
        - Contas (Accounts)
      summary: Atualiza conta
      security:
        - sessionAuth: []
      parameters:
        - name: accountid
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/AccountUpdate'
      responses:
        '200':
          description: Conta atualizada
  
  /adm/delete/account/{accountid}:
    delete:
      tags:
        - Contas (Accounts)
      summary: Exclui conta
      security:
        - sessionAuth: []
      parameters:
        - name: accountid
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Conta excluída
  
  /adm/accounts:
    get:
      tags:
        - Contas (Accounts)
      summary: Lista todas as contas
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Lista de contas
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AccountResponse'
  
  /adm/account:
    get:
      tags:
        - Contas (Accounts)
      summary: Obtém conta do subdomínio atual
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Dados da conta
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountResponse'
  
  # ==================== GRUPOS DE USUÁRIOS ====================
  /adm/register/groupuser:
    post:
      tags:
        - Grupos de Usuários
      summary: Registra grupo de usuários
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserGroupCreate'
      responses:
        '200':
          description: Grupo registrado
  
  /adm/update/groupuser/{groupuserid}:
    patch:
      tags:
        - Grupos de Usuários
      summary: Atualiza grupo de usuários
      security:
        - sessionAuth: []
      parameters:
        - name: groupuserid
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserGroupUpdate'
      responses:
        '200':
          description: Grupo atualizado
  
  /adm/delete/groupuser/{groupuserid}:
    delete:
      tags:
        - Grupos de Usuários
      summary: Exclui grupo de usuários
      security:
        - sessionAuth: []
      parameters:
        - name: groupuserid
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Grupo excluído
  
  /adm/allgroupuser/{Aba}:
    get:
      tags:
        - Grupos de Usuários
      summary: Lista grupos de usuários (paginado)
      security:
        - sessionAuth: []
      parameters:
        - name: Aba
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Lista paginada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse'
  
  /adm/usergroups:
    get:
      tags:
        - Grupos de Usuários
      summary: Lista todos os grupos de usuários
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Lista de grupos
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UserGroupResponse'
  
  /adm/edit/usergroup/{UserGroup}:
    get:
      tags:
        - Grupos de Usuários
      summary: Obtém grupo para edição
      security:
        - sessionAuth: []
      parameters:
        - name: UserGroup
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Dados do grupo
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserGroupResponse'
  
  # ==================== GRUPOS DE ESTAÇÕES ====================
  /adm/register/stationgroup:
    post:
      tags:
        - Grupos de Estações
      summary: Registra grupo de estações
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/StationGroupCreate'
      responses:
        '200':
          description: Grupo registrado
  
  /adm/update/stationgroup/{stationgroupid}:
    patch:
      tags:
        - Grupos de Estações
      summary: Atualiza grupo de estações
      security:
        - sessionAuth: []
      parameters:
        - name: stationgroupid
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/StationGroupUpdate'
      responses:
        '200':
          description: Grupo atualizado
  
  /adm/delete/stationgroup/{stationgroupid}:
    delete:
      tags:
        - Grupos de Estações
      summary: Exclui grupo de estações
      security:
        - sessionAuth: []
      parameters:
        - name: stationgroupid
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Grupo excluído
  
  /adm/groupstation/{Aba}:
    get:
      tags:
        - Grupos de Estações
      summary: Lista grupos de estações com estações (paginado)
      security:
        - sessionAuth: []
      parameters:
        - name: Aba
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Lista paginada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse'
  
  /adm/groupstations:
    get:
      tags:
        - Grupos de Estações
      summary: Lista grupos de estações (simplificado)
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Lista simplificada
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    ID:
                      type: integer
                    NAME:
                      type: string
  
  /adm/edit/groupstation/{groupstation}:
    get:
      tags:
        - Grupos de Estações
      summary: Obtém grupo de estações para edição
      security:
        - sessionAuth: []
      parameters:
        - name: groupstation
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Dados do grupo
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StationGroupResponse'
  
  # ==================== USUÁRIOS ====================
  /adm/register/user:
    post:
      tags:
        - Usuários
      summary: Registra novo usuário
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
      responses:
        '200':
          description: Usuário registrado
  
  /adm/update/user/{userid}:
    patch:
      tags:
        - Usuários
      summary: Atualiza usuário
      security:
        - sessionAuth: []
      parameters:
        - name: userid
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdate'
      responses:
        '200':
          description: Usuário atualizado
  
  /adm/delete/user/{userid}:
    delete:
      tags:
        - Usuários
      summary: Exclui usuário
      security:
        - sessionAuth: []
      parameters:
        - name: userid
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Usuário excluído
  
  /adm/alluser/{Aba}:
    get:
      tags:
        - Usuários
      summary: Lista usuários (paginado)
      security:
        - sessionAuth: []
      parameters:
        - name: Aba
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Lista paginada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse'
  
  /adm/alluserselect:
    get:
      tags:
        - Usuários
      summary: Lista usuários para select
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Lista simplificada
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    ID:
                      type: integer
                    NAME:
                      type: string
                    DOCUMENT:
                      type: string
  
  /adm/edit/user/{User}:
    get:
      tags:
        - Usuários
      summary: Obtém usuário para edição
      security:
        - sessionAuth: []
      parameters:
        - name: User
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Dados do usuário
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
  
  # ==================== ESTAÇÕES ====================
  /adm/register/station:
    post:
      tags:
        - Estações
      summary: Registra nova estação
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/StationCreate'
      responses:
        '200':
          description: Estação registrada
  
  /adm/update/station/{stationid}:
    patch:
      tags:
        - Estações
      summary: Atualiza estação
      security:
        - sessionAuth: []
      parameters:
        - name: stationid
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/StationUpdate'
      responses:
        '200':
          description: Estação atualizada
  
  /adm/delete/station/{stationid}:
    delete:
      tags:
        - Estações
      summary: Exclui estação
      security:
        - sessionAuth: []
      parameters:
        - name: stationid
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Estação excluída
  
  /adm/allstation/{Aba}:
    get:
      tags:
        - Estações
      summary: Lista estações (paginado)
      security:
        - sessionAuth: []
      parameters:
        - name: Aba
          in: path
          required: true
          schema:
            type: integer
        - name: station_group
          in: query
          schema:
            type: integer
        - name: account
          in: query
          schema:
            type: integer
        - name: status
          in: query
          schema:
            type: string
            enum: [ONLINE, OFFLINE, FAULT]
      responses:
        '200':
          description: Lista paginada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse'
  
  /adm/allstations:
    get:
      tags:
        - Estações
      summary: Lista estações (simplificado)
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Lista simplificada
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    ID:
                      type: integer
                    CHARGE_POINT_ID:
                      type: string
                    DESCRIPTION:
                      type: string
                    ONLINE:
                      type: boolean
  
  /adm/edit/station/{IDStation}:
    get:
      tags:
        - Estações
      summary: Obtém estação para edição
      security:
        - sessionAuth: []
      parameters:
        - name: IDStation
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Dados da estação
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StationResponse'
  
  # ==================== TAGS ====================
  /adm/register/tag/{tagid}:
    post:
      tags:
        - Tags
      summary: Registra nova tag
      security:
        - sessionAuth: []
      parameters:
        - name: tagid
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TagCreate'
      responses:
        '200':
          description: Tag registrada
  
  /adm/update/tag/{tagid}:
    patch:
      tags:
        - Tags
      summary: Atualiza tag
      security:
        - sessionAuth: []
      parameters:
        - name: tagid
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TagUpdate'
      responses:
        '200':
          description: Tag atualizada
  
  /adm/delete/tag:
    delete:
      tags:
        - Tags
      summary: Exclui tag
      security:
        - sessionAuth: []
      parameters:
        - name: tagid
          in: query
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Tag excluída
  
  /adm/tag/{Aba}:
    get:
      tags:
        - Tags
      summary: Lista tags (paginado)
      security:
        - sessionAuth: []
      parameters:
        - name: Aba
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Lista paginada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse'
  
  /adm/tags:
    get:
      tags:
        - Tags
      summary: Lista tags habilitadas para select
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Lista de tags
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    ID:
                      type: integer
                    ID_TAG:
                      type: string
  
  /adm/edit/tag/{Tag}:
    get:
      tags:
        - Tags
      summary: Obtém tag para edição
      security:
        - sessionAuth: []
      parameters:
        - name: Tag
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Dados da tag
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TagResponse'
  
  # ==================== PERFIS DE PREÇO ====================
  /adm/register/priceprofile:
    post:
      tags:
        - Perfis de Preço
      summary: Registra perfil de preço
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PriceProfileCreate'
      responses:
        '200':
          description: Perfil registrado
  
  /adm/update/priceprofile/{profileid}:
    patch:
      tags:
        - Perfis de Preço
      summary: Atualiza perfil de preço
      security:
        - sessionAuth: []
      parameters:
        - name: profileid
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PriceProfileUpdate'
      responses:
        '200':
          description: Perfil atualizado
  
  /adm/delete/priceprofile/{profileid}:
    delete:
      tags:
        - Perfis de Preço
      summary: Exclui perfil de preço
      security:
        - sessionAuth: []
      parameters:
        - name: profileid
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Perfil excluído
  
  /adm/priceprofilegroup/{PROFILE_ID}:
    get:
      tags:
        - Perfis de Preço
      summary: Obtém grupo de perfis
      security:
        - sessionAuth: []
      parameters:
        - name: PROFILE_ID
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Dados do grupo
  
  /adm/priceprofile/{ID}:
    get:
      tags:
        - Perfis de Preço
      summary: Obtém perfil específico para edição
      security:
        - sessionAuth: []
      parameters:
        - name: ID
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Dados do perfil
  
  /adm/priceprofiles/{Aba}:
    get:
      tags:
        - Perfis de Preço
      summary: Lista todos os perfis (paginado)
      security:
        - sessionAuth: []
      parameters:
        - name: Aba
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Lista paginada
  
  # ==================== PERFIS DINÂMICOS ====================
  /adm/register/danamicprofile:
    post:
      tags:
        - Perfis Dinâmicos
      summary: Registra perfil dinâmico
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DynamicProfileCreate'
      responses:
        '200':
          description: Perfil dinâmico registrado
  
  /adm/update/danamicprofile/{danamicprofileid}:
    patch:
      tags:
        - Perfis Dinâmicos
      summary: Atualiza perfil dinâmico
      security:
        - sessionAuth: []
      parameters:
        - name: danamicprofileid
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DynamicProfileUpdate'
      responses:
        '200':
          description: Perfil dinâmico atualizado
  
  /adm/delete/danamicprofile/{danamicprofileid}:
    delete:
      tags:
        - Perfis Dinâmicos
      summary: Exclui perfil dinâmico
      security:
        - sessionAuth: []
      parameters:
        - name: danamicprofileid
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Perfil dinâmico excluído
  
  # ==================== RELATÓRIOS ====================
  /adm/report/recharges:
    post:
      tags:
        - Relatórios
      summary: Gera relatório de recargas
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReportRequest'
      responses:
        '200':
          description: Relatório gerado
  
  /adm/report/rechargesgroups:
    post:
      tags:
        - Relatórios
      summary: Gera relatório por grupo de estações
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StationGroupReportRequest'
      responses:
        '200':
          description: Relatório gerado
  
  # ==================== TRANSAÇÕES ====================
  /adm/transactions/{Aba}:
    get:
      tags:
        - Transações
      summary: Lista transações
      security:
        - sessionAuth: []
      parameters:
        - name: Aba
          in: path
          required: true
          schema:
            type: integer
        - name: initial_date
          in: query
          required: true
          schema:
            type: string
            format: date-time
        - name: final_date
          in: query
          required: true
          schema:
            type: string
            format: date-time
        - name: station_name
          in: query
          schema:
            type: string
        - name: station_group
          in: query
          schema:
            type: integer
        - name: tag_id
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Lista paginada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse'
  
  # ==================== TRANSAÇÕES FINANCEIRAS ====================
  /adm/financialtransactions/{Aba}:
    get:
      tags:
        - Transações Financeiras
      summary: Lista transações financeiras
      security:
        - sessionAuth: []
      parameters:
        - name: Aba
          in: path
          required: true
          schema:
            type: integer
        - name: initial_date
          in: query
          required: true
          schema:
            type: string
            format: date-time
        - name: final_date
          in: query
          required: true
          schema:
            type: string
            format: date-time
        - name: account
          in: query
          schema:
            type: integer
        - name: user
          in: query
          schema:
            type: integer
      responses:
        '200':
          description: Lista paginada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse'
  
  # ==================== EVENTOS ====================
  /adm/events/{Aba}:
    get:
      tags:
        - Eventos
      summary: Lista eventos e alertas
      security:
        - sessionAuth: []
      parameters:
        - name: Aba
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Lista paginada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse'
  
  # ==================== COMANDOS OCPP ====================
  /adm/command:
    post:
      tags:
        - Comandos OCPP
      summary: Envia comando OCPP genérico
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OCPPCommandRequest'
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/unlockconnector:
    post:
      tags:
        - Comandos OCPP
      summary: Unlock Connector
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UnlockConnectorCommand'
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/changeavailability:
    post:
      tags:
        - Comandos OCPP
      summary: Change Availability
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChangeAvailabilityCommand'
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/changeconfiguration:
    post:
      tags:
        - Comandos OCPP
      summary: Change Configuration
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - CHARGEPOINTID
                - PAYLOAD
              properties:
                CHARGEPOINTID:
                  type: array
                  items:
                    type: string
                PAYLOAD:
                  type: object
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/clearcache:
    post:
      tags:
        - Comandos OCPP
      summary: Clear Cache
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - CHARGEPOINTID
                - PAYLOAD
              properties:
                CHARGEPOINTID:
                  type: array
                  items:
                    type: string
                PAYLOAD:
                  type: object
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/clearchargingprofile:
    post:
      tags:
        - Comandos OCPP
      summary: Clear Charging Profile
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - CHARGEPOINTID
                - PAYLOAD
              properties:
                CHARGEPOINTID:
                  type: array
                  items:
                    type: string
                PAYLOAD:
                  type: object
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/datatransfer:
    post:
      tags:
        - Comandos OCPP
      summary: Data Transfer
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - CHARGEPOINTID
                - PAYLOAD
              properties:
                CHARGEPOINTID:
                  type: array
                  items:
                    type: string
                PAYLOAD:
                  type: object
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/getconfiguration:
    post:
      tags:
        - Comandos OCPP
      summary: Get Configuration
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - CHARGEPOINTID
                - PAYLOAD
              properties:
                CHARGEPOINTID:
                  type: array
                  items:
                    type: string
                PAYLOAD:
                  type: object
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/remotestarttransaction:
    post:
      tags:
        - Comandos OCPP
      summary: Remote Start Transaction
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RemoteStartCommand'
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/remotestoptransaction:
    post:
      tags:
        - Comandos OCPP
      summary: Remote Stop Transaction
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RemoteStopCommand'
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/reset:
    post:
      tags:
        - Comandos OCPP
      summary: Reset
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetCommand'
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/setchargingprofile:
    post:
      tags:
        - Comandos OCPP
      summary: Set Charging Profile
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - CHARGEPOINTID
                - PAYLOAD
              properties:
                CHARGEPOINTID:
                  type: array
                  items:
                    type: string
                PAYLOAD:
                  type: object
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/triggermessage:
    post:
      tags:
        - Comandos OCPP
      summary: Trigger Message
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - CHARGEPOINTID
                - PAYLOAD
              properties:
                CHARGEPOINTID:
                  type: array
                  items:
                    type: string
                PAYLOAD:
                  type: object
                  properties:
                    requested_message:
                      type: string
                      enum: [BootNotification, DiagnosticsStatusNotification, FirmwareStatusNotification, Heartbeat, MeterValues, StatusNotification]
                    connector_id:
                      type: integer
      responses:
        '200':
          description: Comando enviado
  
  /adm/command/updatefirmware:
    post:
      tags:
        - Comandos OCPP
      summary: Update Firmware
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - CHARGEPOINTID
                - PAYLOAD
              properties:
                CHARGEPOINTID:
                  type: array
                  items:
                    type: string
                PAYLOAD:
                  type: object
                  properties:
                    location:
                      type: string
                    retrieve_date_time:
                      type: string
                    retries:
                      type: integer
                    retry_interval:
                      type: integer
      responses:
        '200':
          description: Comando enviado
  
  # ==================== PAGAMENTOS ====================
  /adm/create_pix_payment:
    post:
      tags:
        - Pagamentos
      summary: Cria cobrança PIX
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PIXPaymentCreate'
      responses:
        '200':
          description: Cobrança criada
  
  /adm/pix_payment_status/{txid}:
    get:
      tags:
        - Pagamentos
      summary: Consulta status PIX
      security:
        - sessionAuth: []
      parameters:
        - name: txid
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Status da cobrança
  
  /adm/create_card_payment:
    post:
      tags:
        - Pagamentos
      summary: Cria pagamento com cartão
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CardPaymentCreate'
      responses:
        '200':
          description: Pagamento criado
  
  /adm/card_payment_status/{checkout_id}:
    get:
      tags:
        - Pagamentos
      summary: Consulta status do checkout
      security:
        - sessionAuth: []
      parameters:
        - name: checkout_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Status do pagamento
  
  /adm/cancel_card_payment:
    post:
      tags:
        - Pagamentos
      summary: Cancela pagamento com cartão
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - checkout_id
                - reason
              properties:
                checkout_id:
                  type: string
                payment_id:
                  type: string
                amount:
                  type: number
                reason:
                  type: string
      responses:
        '200':
          description: Pagamento cancelado
  
  # ==================== MERCADO PAGO ====================
  /mercadopago/webhook:
    post:
      tags:
        - Mercado Pago
      summary: Webhook do Mercado Pago
      responses:
        '200':
          description: Recebido
  
  /mercadopago/test-webhook:
    get:
      tags:
        - Mercado Pago
      summary: Teste de webhook
      responses:
        '200':
          description: Teste realizado
  
  /mercadopago/create-pix:
    post:
      tags:
        - Mercado Pago
      summary: Cria pagamento PIX
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - amount
                - description
              properties:
                amount:
                  type: number
                description:
                  type: string
                expires_minutes:
                  type: integer
                  default: 30
      responses:
        '200':
          description: PIX criado
  
  /mercadopago/pix-status/{payment_id}:
    get:
      tags:
        - Mercado Pago
      summary: Consulta status PIX
      security:
        - sessionAuth: []
      parameters:
        - name: payment_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Status do PIX
  
  /mercadopago/create-card:
    post:
      tags:
        - Mercado Pago
      summary: Cria pagamento com cartão
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - amount
                - token
                - device_id
              properties:
                amount:
                  type: number
                token:
                  type: string
                device_id:
                  type: string
                description:
                  type: string
                installments:
                  type: integer
                  default: 1
                payment_method_id:
                  type: string
      responses:
        '200':
          description: Pagamento criado
  
  /mercadopago/payment/{payment_id}:
    get:
      tags:
        - Mercado Pago
      summary: Consulta pagamento
      security:
        - sessionAuth: []
      parameters:
        - name: payment_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Detalhes do pagamento
  
  /mercadopago/refund/{payment_id}:
    post:
      tags:
        - Mercado Pago
      summary: Reembolso
      security:
        - sessionAuth: []
      parameters:
        - name: payment_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: number
      responses:
        '200':
          description: Reembolso realizado
  
  # ==================== USUÁRIO FINAL ====================
  /usr/home:
    get:
      tags:
        - Usuário Final
      summary: Tela inicial do usuário
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Dados do dashboard do usuário
  
  /usr/station/{stationId}:
    get:
      tags:
        - Usuário Final
      summary: Obtém informações da estação
      security:
        - sessionAuth: []
      parameters:
        - name: stationId
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Dados da estação
  
  /usr/starttransaction/station/{stationId}:
    post:
      tags:
        - Usuário Final
      summary: Inicia transação
      security:
        - sessionAuth: []
      parameters:
        - name: stationId
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserStartTransactionRequest'
      responses:
        '200':
          description: Transação iniciada
        '202':
          description: Pré-autorização realizada
  
  /usr/stoptransaction/station/{stationId}:
    post:
      tags:
        - Usuário Final
      summary: Para transação
      security:
        - sessionAuth: []
      parameters:
        - name: stationId
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Comando enviado
  
  /usr/statustransaction/station/{stationId}:
    get:
      tags:
        - Usuário Final
      summary: Status da transação
      security:
        - sessionAuth: []
      parameters:
        - name: stationId
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Status da transação
  
  /usr/register/user:
    post:
      tags:
        - Usuário Final
      summary: Auto-cadastro de usuário
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
      responses:
        '200':
          description: Usuário registrado
  
  /usr/edit/user:
    get:
      tags:
        - Usuário Final
      summary: Obtém dados do próprio usuário
      security:
        - sessionAuth: []
      responses:
        '200':
          description: Dados do usuário
  
  /usr/update/user:
    patch:
      tags:
        - Usuário Final
      summary: Atualiza dados do próprio usuário
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdate'
      responses:
        '200':
          description: Usuário atualizado
  
  # ==================== NFS-e ====================
  /adm/nfse/direta/emitir:
    post:
      tags:
        - NFS-e
      summary: Emite NFS-e
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NFSeEmitirRequest'
      responses:
        '200':
          description: NFS-e emitida
  
  /adm/nfse/direta/consultar:
    post:
      tags:
        - NFS-e
      summary: Consulta NFS-e (online)
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NFSeConsultaRequest'
      responses:
        '200':
          description: Dados da nota
  
  /adm/nfse/direta/cancelar:
    post:
      tags:
        - NFS-e
      summary: Cancela NFS-e
      security:
        - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NFSeCancelarRequest'
      responses:
        '200':
          description: Nota cancelada
  
  /adm/nfse/direta/{numero_nota}:
    get:
      tags:
        - NFS-e
      summary: Consulta NFS-e (banco local)
      security:
        - sessionAuth: []
      parameters:
        - name: numero_nota
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Dados da nota
        '404':
          description: Nota não encontrada
  
  # ==================== LOGS ====================
  /adm/log/ocpp/download:
    get:
      tags:
        - Logs
      summary: Download de logs OCPP
      security:
        - sessionAuth: []
      parameters:
        - name: stations
          in: query
          schema:
            type: string
        - name: start_date
          in: query
          schema:
            type: string
        - name: end_date
          in: query
          schema:
            type: string
        - name: direction
          in: query
          schema:
            type: string
            enum: [CALL, CALLRESULT]
      responses:
        '200':
          description: Arquivo de log
  
  # ==================== DEBUG ====================
  /debug/info:
    get:
      tags:
        - Debug
      summary: Informações de debug
      responses:
        '200':
          description: Informações do servidor
  
  /test/setup-subdomain:
    post:
      tags:
        - Debug
      summary: Configura subdomínio de teste
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - account_id
                - subdomain
              properties:
                account_id:
                  type: integer
                subdomain:
                  type: string
      responses:
        '200':
          description: Subdomínio configurado