{
    "openapi": "3.0.0",
    "info": {
        "title": "Pagos API",
        "description": "API para autenticación y gestión de usuarios con JWT",
        "version": "1.0.0"
    },
    "paths": {
        "/api/register": {
            "post": {
                "tags": [
                    "Autenticación"
                ],
                "summary": "Registro de nuevo usuario",
                "operationId": "8a56853624e025573120a09a4c75d468",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "email",
                                    "password",
                                    "role"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password"
                                    },
                                    "phone": {
                                        "type": "string",
                                        "example": "04121234567"
                                    },
                                    "document_type": {
                                        "type": "string",
                                        "example": "V"
                                    },
                                    "document_number": {
                                        "type": "string",
                                        "example": "15825639"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "role": {
                                        "type": "string",
                                        "enum": [
                                            "admin",
                                            "operator",
                                            "viewer"
                                        ]
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Usuario creado"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                }
            }
        },
        "/api/login": {
            "post": {
                "tags": [
                    "Autenticación"
                ],
                "summary": "Login de usuario",
                "operationId": "a3b306d14572d1f4bd6c064b3233e7b8",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "password"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Login exitoso"
                    },
                    "401": {
                        "description": "Credenciales inválidas"
                    }
                }
            }
        },
        "/api/logout": {
            "post": {
                "tags": [
                    "Autenticación"
                ],
                "summary": "Cerrar sesión",
                "operationId": "fe8f3429cd6979b3b4517e186505f9f9",
                "responses": {
                    "200": {
                        "description": "Sesión cerrada"
                    },
                    "500": {
                        "description": "Error al cerrar sesión"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/refresh": {
            "post": {
                "tags": [
                    "Autenticación"
                ],
                "summary": "Refrescar token JWT",
                "operationId": "2c27d311a2876560fcb5a754b556cdc5",
                "responses": {
                    "200": {
                        "description": "Token refrescado"
                    },
                    "500": {
                        "description": "Error al refrescar token"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/me": {
            "get": {
                "tags": [
                    "Autenticación"
                ],
                "summary": "Obtener usuario autenticado",
                "operationId": "9d9bc556f927575aa492a88c28fe5908",
                "responses": {
                    "200": {
                        "description": "Datos del usuario"
                    },
                    "401": {
                        "description": "Token inválido o expirado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/banks": {
            "get": {
                "tags": [
                    "Bancos"
                ],
                "summary": "Obtener lista de bancos",
                "operationId": "caa138ee4cdf9701a3ec3c3198e9f777",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "description": "Búsqueda por nombre o código",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "venezuela"
                        }
                    },
                    {
                        "name": "is_active",
                        "in": "query",
                        "description": "Filtro por estado activo",
                        "required": false,
                        "schema": {
                            "type": "boolean",
                            "example": true
                        }
                    },
                    {
                        "name": "supports_debit",
                        "in": "query",
                        "description": "Filtro por soporte de débito",
                        "required": false,
                        "schema": {
                            "type": "boolean",
                            "example": true
                        }
                    },
                    {
                        "name": "supports_transfer",
                        "in": "query",
                        "description": "Filtro por soporte de transferencias",
                        "required": false,
                        "schema": {
                            "type": "boolean",
                            "example": true
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Cantidad de resultados por página",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 15
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Lista paginada de bancos",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Token inválido o expirado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Bancos"
                ],
                "summary": "Crear un nuevo banco",
                "operationId": "3fa927bf23da99bcc82d71249de2c6d5",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "code",
                                    "name"
                                ],
                                "properties": {
                                    "code": {
                                        "description": "Código del banco",
                                        "type": "string",
                                        "maxLength": 10,
                                        "example": "001"
                                    },
                                    "name": {
                                        "description": "Nombre del banco",
                                        "type": "string",
                                        "maxLength": 255,
                                        "example": "Banco de Venezuela"
                                    },
                                    "is_active": {
                                        "description": "Estado activo del banco",
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "supports_debit": {
                                        "description": "Soporte para pagos con débito",
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "supports_transfer": {
                                        "description": "Soporte para transferencias",
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "api_endpoint": {
                                        "description": "Endpoint de la API del banco",
                                        "type": "string",
                                        "format": "url",
                                        "example": "https://api.banco.com"
                                    },
                                    "api_key": {
                                        "description": "Clave API del banco",
                                        "type": "string",
                                        "example": "your-api-key"
                                    },
                                    "phone": {
                                        "description": "Teléfono del banco",
                                        "type": "string",
                                        "maxLength": 13,
                                        "example": "0424-1234567"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Banco creado exitosamente",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Banco creado exitosamente"
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos de validación incorrectos"
                    },
                    "401": {
                        "description": "Token inválido o expirado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/banks/{bank}": {
            "get": {
                "tags": [
                    "Bancos"
                ],
                "summary": "Obtener un banco específico",
                "operationId": "4b557b8cc027d2e1abfb49e6026f6ac0",
                "parameters": [
                    {
                        "name": "bank",
                        "in": "path",
                        "description": "ID del banco",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Datos del banco",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Banco no encontrado"
                    },
                    "401": {
                        "description": "Token inválido o expirado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Bancos"
                ],
                "summary": "Actualizar un banco",
                "operationId": "b3e847f4926a39d10d1ab046703d8ee7",
                "parameters": [
                    {
                        "name": "bank",
                        "in": "path",
                        "description": "ID del banco",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "code": {
                                        "description": "Código del banco",
                                        "type": "string",
                                        "maxLength": 10,
                                        "example": "001"
                                    },
                                    "name": {
                                        "description": "Nombre del banco",
                                        "type": "string",
                                        "maxLength": 255,
                                        "example": "Banco de Venezuela"
                                    },
                                    "is_active": {
                                        "description": "Estado activo del banco",
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "supports_debit": {
                                        "description": "Soporte para pagos con débito",
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "supports_transfer": {
                                        "description": "Soporte para transferencias",
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "api_endpoint": {
                                        "description": "Endpoint de la API del banco",
                                        "type": "string",
                                        "format": "url",
                                        "example": "https://api.banco.com"
                                    },
                                    "api_key": {
                                        "description": "Clave API del banco",
                                        "type": "string",
                                        "example": "your-api-key"
                                    },
                                    "phone": {
                                        "description": "Teléfono del banco",
                                        "type": "string",
                                        "maxLength": 13,
                                        "example": "0424-1234567"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Banco actualizado exitosamente",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Banco actualizado exitosamente"
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos de validación incorrectos"
                    },
                    "404": {
                        "description": "Banco no encontrado"
                    },
                    "401": {
                        "description": "Token inválido o expirado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Bancos"
                ],
                "summary": "Eliminar un banco",
                "operationId": "bfbc0674acb8a3e46c1ad30b0ee5eb3f",
                "parameters": [
                    {
                        "name": "bank",
                        "in": "path",
                        "description": "ID del banco",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Banco eliminado exitosamente",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Banco eliminado exitosamente"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "No se puede eliminar el banco porque tiene pagos asociados"
                    },
                    "404": {
                        "description": "Banco no encontrado"
                    },
                    "401": {
                        "description": "Token inválido o expirado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/banks/active": {
            "get": {
                "tags": [
                    "Bancos"
                ],
                "summary": "Obtener bancos activos",
                "operationId": "c86d60a0c878c084a15c83291098d983",
                "responses": {
                    "200": {
                        "description": "Lista de bancos activos",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Token inválido o expirado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/banks/debit-supported": {
            "get": {
                "tags": [
                    "Bancos"
                ],
                "summary": "Obtener bancos que soportan débito",
                "operationId": "ca9ee1058b0ff9b00bf5fd6c06572f96",
                "responses": {
                    "200": {
                        "description": "Lista de bancos que soportan pagos con débito",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Token inválido o expirado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/banks/transfer-supported": {
            "get": {
                "tags": [
                    "Bancos"
                ],
                "summary": "Obtener bancos que soportan transferencias",
                "operationId": "3187646dfa631bb541ddb9123d76f967",
                "responses": {
                    "200": {
                        "description": "Lista de bancos que soportan transferencias",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Token inválido o expirado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/banks/{bank}/toggle-active": {
            "post": {
                "tags": [
                    "Bancos"
                ],
                "summary": "Cambiar estado activo de un banco",
                "operationId": "a90c2c5e1ce500d5be9f4259760d6017",
                "parameters": [
                    {
                        "name": "bank",
                        "in": "path",
                        "description": "ID del banco",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Estado del banco cambiado exitosamente",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Banco activado exitosamente"
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Banco no encontrado"
                    },
                    "401": {
                        "description": "Token inválido o expirado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/bcv-rates/current": {
            "get": {
                "tags": [
                    "BCV"
                ],
                "summary": "Obtener tasa BCV actual",
                "description": "Devuelve la tasa BCV vigente para hoy",
                "operationId": "1029abe4fce047b2b5fc8dda4a847257",
                "responses": {
                    "200": {
                        "description": "Tasa BCV obtenida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "properties": {
                                                "rate": {
                                                    "type": "number",
                                                    "format": "float",
                                                    "example": 36.4500000000000028421709430404007434844970703125
                                                },
                                                "date": {
                                                    "type": "string",
                                                    "format": "date",
                                                    "example": "2025-10-31"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No hay tasa disponible",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "No hay tasa BCV disponible para hoy"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/bcv-rates/set-today": {
            "post": {
                "tags": [
                    "BCV"
                ],
                "summary": "Establecer tasa BCV de hoy",
                "description": "Set today's BCV rate.",
                "operationId": "9a87dd7a8df7b64bb5c65801ef84c265",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "rate"
                                ],
                                "properties": {
                                    "rate": {
                                        "type": "number",
                                        "format": "float",
                                        "example": 36.4500000000000028421709430404007434844970703125
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Tasa actualizada",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Tasa BCV actualizada exitosamente"
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Datos de validación incorrectos"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/bcv-rates/history": {
            "get": {
                "tags": [
                    "BCV"
                ],
                "summary": "Histórico de tasas BCV",
                "description": "Get BCV rate history.",
                "operationId": "e75f515521278085325fd12d379112d7",
                "parameters": [
                    {
                        "name": "date_from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 15
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado paginado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/bcv-rates/by-date": {
            "get": {
                "tags": [
                    "BCV"
                ],
                "summary": "Obtener tasa BCV por fecha",
                "description": "Get BCV rate by date.",
                "operationId": "05eb602eb582eea6d2899168220784d9",
                "parameters": [
                    {
                        "name": "date",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Tasa encontrada",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No encontrada",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "No hay tasa BCV disponible para la fecha especificada"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Datos de validación incorrectos"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/clients": {
            "get": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Listar clientes",
                "description": "Obtiene una lista paginada de clientes con filtros opcionales",
                "operationId": "af1f3794367a5e843bf15e3a9033d911",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "description": "Término de búsqueda",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "document_type",
                        "in": "query",
                        "description": "Tipo de documento",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "V",
                                "E",
                                "J",
                                "P",
                                "G"
                            ]
                        }
                    },
                    {
                        "name": "is_active",
                        "in": "query",
                        "description": "Estado activo",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Elementos por página",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 15
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Lista de clientes obtenida exitosamente",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "No autorizado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "No autorizado"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Crear cliente",
                "operationId": "15981a5da120d8b4ea1b91b05a35622b",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "document_type",
                                    "document_number"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "example": "Juan Pérez"
                                    },
                                    "document_type": {
                                        "type": "string",
                                        "enum": [
                                            "V",
                                            "E",
                                            "J",
                                            "P",
                                            "G"
                                        ]
                                    },
                                    "document_number": {
                                        "type": "string",
                                        "example": "12345678"
                                    },
                                    "phone": {
                                        "type": "string",
                                        "example": "04121234567"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "juan@example.com"
                                    },
                                    "address": {
                                        "type": "string"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "user_id": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "usuariowisphub": {
                                        "type": "string",
                                        "example": "usuario_wisphub"
                                    },
                                    "idservicio": {
                                        "type": "integer",
                                        "example": 123
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Cliente creado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Cliente creado exitosamente"
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Documento duplicado"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/clients/{client}": {
            "get": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Obtener cliente",
                "operationId": "8fc07341eb8ece62ad4fdda3a30c7b25",
                "parameters": [
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Cliente obtenido"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Actualizar cliente",
                "operationId": "558832db987fc02c8a5107fb013891c9",
                "parameters": [
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "example": "Juan Pérez"
                                    },
                                    "document_type": {
                                        "type": "string",
                                        "enum": [
                                            "V",
                                            "E",
                                            "J",
                                            "P",
                                            "G"
                                        ]
                                    },
                                    "document_number": {
                                        "type": "string",
                                        "example": "12345678"
                                    },
                                    "phone": {
                                        "type": "string",
                                        "example": "04121234567"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "juan@example.com"
                                    },
                                    "address": {
                                        "type": "string"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "user_id": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "usuariowisphub": {
                                        "type": "string",
                                        "example": "usuario_wisphub"
                                    },
                                    "idservicio": {
                                        "type": "integer",
                                        "example": 123
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Cliente actualizado"
                    },
                    "409": {
                        "description": "Documento duplicado"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Eliminar cliente",
                "operationId": "9102c26412072310db7ca015461a16cb",
                "parameters": [
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Cliente eliminado"
                    },
                    "409": {
                        "description": "Tiene contratos activos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/clients/search": {
            "get": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Buscar cliente por documento",
                "operationId": "cf24d6ad748e1ea565bb8c41f57d4534",
                "parameters": [
                    {
                        "name": "document_type",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "V",
                                "E",
                                "J",
                                "P",
                                "G"
                            ]
                        }
                    },
                    {
                        "name": "document_number",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Cliente encontrado"
                    },
                    "404": {
                        "description": "No encontrado"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/clients/{client}/contracts": {
            "get": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Contratos del cliente",
                "operationId": "45f8e16b6afd2200e638f29d18d337a6",
                "parameters": [
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado de contratos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/contracts": {
            "get": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Listar contratos",
                "operationId": "ee3d11bd377d704f11055900ae0bca16",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "active",
                                "suspended",
                                "cancelled",
                                "expired"
                            ]
                        }
                    },
                    {
                        "name": "is_active",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 15
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado paginado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Crear contrato",
                "operationId": "16cfc7a89e05bcca267234e620042864",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "contract_number",
                                    "client_id",
                                    "service_type",
                                    "service_plan",
                                    "monthly_amount",
                                    "start_date"
                                ],
                                "properties": {
                                    "contract_number": {
                                        "type": "string"
                                    },
                                    "client_id": {
                                        "type": "integer"
                                    },
                                    "service_type": {
                                        "type": "string"
                                    },
                                    "service_plan": {
                                        "type": "string"
                                    },
                                    "monthly_amount": {
                                        "type": "number",
                                        "format": "float"
                                    },
                                    "start_date": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "end_date": {
                                        "type": "string",
                                        "format": "date",
                                        "nullable": true
                                    },
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "active",
                                            "suspended",
                                            "cancelled",
                                            "expired"
                                        ],
                                        "nullable": true
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Contrato creado"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/paid-invoices/{bdclient}/pagos-realizados-movil": {
            "get": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Listar contratos con facturas pagadas y swoficina=0",
                "operationId": "75cbc8577897bd6f6940eb9d27e6815c",
                "parameters": [
                    {
                        "name": "bdclient",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado de contratos con facturas pagadas"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/contracts/{contract}": {
            "get": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Obtener contrato",
                "operationId": "6cf16b0aa91af0b8b99a55f175d78aa6",
                "parameters": [
                    {
                        "name": "contract",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Contrato obtenido"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Actualizar contrato",
                "operationId": "4128fabdd64a3585fa1ec256e064ae2d",
                "parameters": [
                    {
                        "name": "contract",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Contrato actualizado"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Eliminar contrato",
                "operationId": "0d0a72121e014407f77d8afd206ed45f",
                "parameters": [
                    {
                        "name": "contract",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Contrato eliminado"
                    },
                    "409": {
                        "description": "Tiene facturas pendientes"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/contracts/invoices/{invoice_number}/mark-swoficina": {
            "put": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Marcar factura con swoficina=1 por que el cliente pago desde la App Movil",
                "operationId": "a0123b4bd38b8bda06c6a60705976904",
                "parameters": [
                    {
                        "name": "invoice_number",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Factura marcada correctamente"
                    },
                    "404": {
                        "description": "Factura no encontrada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/contracts/invoices/{numero_contrato}/mark-swoficinaalfa": {
            "put": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Marcar factura con swoficina=2 por que el cliente pago en la taquilla",
                "operationId": "64745f19b582cac83ce3d51673615353",
                "parameters": [
                    {
                        "name": "invoice_number",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Factura marcada correctamente"
                    },
                    "404": {
                        "description": "Factura no encontrada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/contracts/update-client-contract/{bdclient}": {
            "put": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Actualizar cliente y contrato por cédula y contrato",
                "description": "Busca el cliente por document_number (clients) y el contrato por contract_number (input: contract_numbert) validando la relación clients.id = contracts.client_id. Actualiza name/usuariowisphub/idservicio en clients, phone solo si se envía, y usuariowisphub/idservicio en contracts.",
                "operationId": "129d8bd47cc84cd1d2a4115c474e238c",
                "parameters": [
                    {
                        "name": "bdclient",
                        "in": "path",
                        "description": "Nombre de la conexión/base de datos (multi-tenant)",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "document_number",
                                    "name",
                                    "usuariowisphub",
                                    "idservicio",
                                    "contract_numbert"
                                ],
                                "properties": {
                                    "document_number": {
                                        "type": "string",
                                        "example": "643140"
                                    },
                                    "cedula_anterior": {
                                        "type": "string",
                                        "example": "643140"
                                    },
                                    "name": {
                                        "type": "string",
                                        "example": "MANUEL ANTONIO PEREZ MENDEZ"
                                    },
                                    "phone": {
                                        "type": "string",
                                        "example": "04241254981",
                                        "nullable": true
                                    },
                                    "usuariowisphub": {
                                        "type": "string",
                                        "example": "manuela@tv-daf-2013-ca"
                                    },
                                    "idservicio": {
                                        "type": "integer",
                                        "example": 2208
                                    },
                                    "contract_numbert": {
                                        "type": "string",
                                        "example": "A-000001"
                                    },
                                    "bdclient": {
                                        "type": "string",
                                        "example": "tvdaf2013_apppagodaf",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Actualización exitosa"
                    },
                    "404": {
                        "description": "Cliente o contrato no encontrado"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    },
                    "500": {
                        "description": "Error interno"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/contracts/{contractNumber}/payment-history/{bdcliente}": {
            "get": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Historial de pagos por número de contrato",
                "operationId": "9eb01703e6f02446d1532fd2cc0b87ec",
                "parameters": [
                    {
                        "name": "contractNumber",
                        "in": "path",
                        "description": "Número de contrato",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "bdcliente",
                        "in": "path",
                        "description": "Nombre de la conexión/base de datos",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Historial de pagos del contrato"
                    },
                    "404": {
                        "description": "Contrato no encontrado"
                    }
                }
            }
        },
        "/contracts/invoices/{invoiceId}/payment-transactions/{bdcliente}": {
            "get": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Transacciones de pago vinculadas a una factura",
                "description": "Lista los registros de payments relacionados por invoices.id = payments.invoice_id",
                "operationId": "69c0f8f3e52bb0da327b67084a9a30a1",
                "parameters": [
                    {
                        "name": "invoiceId",
                        "in": "path",
                        "description": "ID de la factura (invoices.id)",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "bdcliente",
                        "in": "path",
                        "description": "Nombre de la conexión/base de datos",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado de transacciones de pago"
                    },
                    "404": {
                        "description": "Factura no encontrada"
                    }
                }
            }
        },
        "/contracts/{contract}/invoices/{bdcliente}": {
            "get": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Facturas del contrato",
                "operationId": "605b3e64e500f775c4a24afbef0082d5",
                "parameters": [
                    {
                        "name": "contract",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "bdcliente",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado de facturas"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/contracts/{contract}/payments": {
            "get": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Pagos del contrato",
                "operationId": "13f6f2b0fe0b3fd5468761e5c6dba9a8",
                "parameters": [
                    {
                        "name": "contract",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado de pagos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/contracts/{contract}/suspend": {
            "post": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Suspender contrato",
                "operationId": "8a5ead97529cda6bfb62b76972a1763f",
                "parameters": [
                    {
                        "name": "contract",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Contrato suspendido"
                    },
                    "409": {
                        "description": "Ya está suspendido"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/contracts/{contract}/reactivate": {
            "post": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Reactivar contrato",
                "operationId": "a704b4f2e6b4df7130b30305dd7f86f3",
                "parameters": [
                    {
                        "name": "contract",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Contrato reactivado"
                    },
                    "409": {
                        "description": "Estado inválido"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/paid-invoices/{bdclient}/{swpago}/pagos-realizados-movillisto": {
            "get": {
                "tags": [
                    "Contratos"
                ],
                "summary": "Listar clientes  contratos con facturas pagadas y swoficina=0",
                "operationId": "0b2f6c08a58609753d6d533974c9678c",
                "parameters": [
                    {
                        "name": "bdclientcont",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado de contratos con facturas pagadas"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/invoices": {
            "get": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Listar facturas",
                "operationId": "2918f8941342b3fb67e05747c84292d9",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "contract_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pending",
                                "paid",
                                "overdue",
                                "cancelled"
                            ]
                        }
                    },
                    {
                        "name": "date_from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 15
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado paginado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Crear factura",
                "operationId": "62ead27e7a908ee508c3f24b2319f43a",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "contract_id",
                                    "amount",
                                    "due_date"
                                ],
                                "properties": {
                                    "contract_id": {
                                        "type": "integer"
                                    },
                                    "amount": {
                                        "type": "number",
                                        "format": "float"
                                    },
                                    "description": {
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "due_date": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "reference_number": {
                                        "type": "string",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Factura creada"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/invoices/check": {
            "get": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Verificar existencia de factura y devolver ID",
                "operationId": "322ec7a4c1615a1026011bd4ed60f813",
                "parameters": [
                    {
                        "name": "invoice_number",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "ID de la factura o 0 si no existe"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/invoices/{invoice}": {
            "get": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Obtener factura",
                "operationId": "a517b1c0858b8c36d4813499c3d8053e",
                "parameters": [
                    {
                        "name": "invoice",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Factura obtenida"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Actualizar factura",
                "operationId": "a40e07f5b2e5800f3ae9730319040d51",
                "parameters": [
                    {
                        "name": "invoice",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Factura actualizada"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Eliminar factura",
                "operationId": "1a2cf0dde9ee2180fbdaf078b4329597",
                "parameters": [
                    {
                        "name": "invoice",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Factura eliminada"
                    },
                    "409": {
                        "description": "Ya pagada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/invoices/{invoice}/mark-paid": {
            "post": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Marcar factura como pagada",
                "operationId": "7aa1595e8a0743aab5211742c3597ae2",
                "parameters": [
                    {
                        "name": "invoice",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Factura pagada"
                    },
                    "409": {
                        "description": "Ya pagada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/invoices/{invoice}/mark-overdue": {
            "post": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Marcar factura como vencida",
                "operationId": "42bd2a6b9c2252e4dc2c731876777b95",
                "parameters": [
                    {
                        "name": "invoice",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Factura vencida"
                    },
                    "409": {
                        "description": "Estado inválido"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/invoices/pending": {
            "get": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Facturas pendientes",
                "operationId": "d33e06a7a1a5be35a8913e2221bd39ac",
                "responses": {
                    "200": {
                        "description": "Listado de facturas pendientes"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/invoices/overdue": {
            "get": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Facturas vencidas",
                "operationId": "e7a2805076add829cf24d30f6b0b7b4b",
                "responses": {
                    "200": {
                        "description": "Listado de facturas vencidas"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/invoices/paid": {
            "get": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Facturas pagadas",
                "operationId": "cb3be6aa6e5f0bda976a4f63441757ff",
                "responses": {
                    "200": {
                        "description": "Listado de facturas pagadas"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/invoices/lotefacturas": {
            "post": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Crear lote de facturas",
                "operationId": "597f3ca3d308061a129af7b9d9fc8ad8",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "array",
                                "items": {
                                    "required": [
                                        "contract_id",
                                        "amount",
                                        "due_date"
                                    ],
                                    "properties": {
                                        "invoice_number": {
                                            "type": "string"
                                        },
                                        "contract_id": {
                                            "type": "integer"
                                        },
                                        "amount": {
                                            "type": "number",
                                            "format": "float"
                                        },
                                        "pending_amount": {
                                            "type": "number",
                                            "format": "float"
                                        },
                                        "balance_please": {
                                            "type": "number",
                                            "format": "float"
                                        },
                                        "description": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "due_date": {
                                            "type": "string",
                                            "format": "date"
                                        },
                                        "reference_number": {
                                            "type": "string",
                                            "nullable": true
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Facturas creadas"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments": {
            "get": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Listar pagos",
                "operationId": "65567ad73dd4b0cc01c4856a6bb7e600",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "contract_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pending",
                                "processing",
                                "completed",
                                "failed",
                                "cancelled"
                            ]
                        }
                    },
                    {
                        "name": "payment_method",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "debit",
                                "transfer",
                                "cash",
                                "mobile_payment"
                            ]
                        }
                    },
                    {
                        "name": "date_from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 15
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado paginado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments/{bdcliente}": {
            "post": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Crear pago",
                "operationId": "e516463dd6431af6bd63b2dbf7178853",
                "parameters": [
                    {
                        "name": "bdcliente",
                        "in": "path",
                        "description": "Nombre de la conexión de base de datos (mysql, mysql_second, mysql_third)",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "mysql",
                                "mysql_second",
                                "mysql_third"
                            ]
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "client_id",
                                    "contract_id",
                                    "amount",
                                    "payment_method"
                                ],
                                "properties": {
                                    "client_id": {
                                        "type": "integer"
                                    },
                                    "contract_id": {
                                        "type": "integer"
                                    },
                                    "invoice_id": {
                                        "type": "integer",
                                        "nullable": true
                                    },
                                    "amount": {
                                        "type": "number",
                                        "format": "float"
                                    },
                                    "payment_method": {
                                        "type": "string",
                                        "enum": [
                                            "debit",
                                            "transfer",
                                            "cash",
                                            "mobile_payment"
                                        ]
                                    },
                                    "bank_id": {
                                        "type": "integer",
                                        "nullable": true
                                    },
                                    "reference_number": {
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "phone_number": {
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "document_type": {
                                        "type": "string",
                                        "enum": [
                                            "V",
                                            "E",
                                            "J",
                                            "P",
                                            "G"
                                        ],
                                        "nullable": true
                                    },
                                    "document_number": {
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "otp_code": {
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "notes": {
                                        "type": "string",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Pago creado exitosamente"
                    },
                    "401": {
                        "description": "No autenticado - Token requerido"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments/invoice-paid/{bdcliente}": {
            "put": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Marcar factura como pagada por número de factura",
                "operationId": "d326d9b94407a08c026902ed4488e3c7",
                "parameters": [
                    {
                        "name": "bdcliente",
                        "in": "path",
                        "description": "Nombre de la conexión de base de datos (mysql, mysql_second, mysql_third)",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "mysql",
                                "mysql_second",
                                "mysql_third"
                            ]
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "invoice_number",
                                    "authorization_key"
                                ],
                                "properties": {
                                    "invoice_number": {
                                        "type": "string"
                                    },
                                    "authorization_key": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Factura actualizada exitosamente"
                    },
                    "403": {
                        "description": "Clave de autorización inválida"
                    },
                    "404": {
                        "description": "Factura no encontrada"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments/invoice-amount/verify-key": {
            "post": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Verificar clave de autorización para cambiar el monto de una factura",
                "operationId": "28240a29e60325b4e6dfd01bf5a957e4",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "authorization_key"
                                ],
                                "properties": {
                                    "authorization_key": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Clave válida"
                    },
                    "403": {
                        "description": "Clave de autorización inválida"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments/invoice-amount/{bdcliente}": {
            "put": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Actualizar el monto de una factura pendiente y el monto mensual de su contrato",
                "operationId": "6ff79664567cd47ce2e66756bf3d4161",
                "parameters": [
                    {
                        "name": "bdcliente",
                        "in": "path",
                        "description": "Nombre de la conexión de base de datos (mysql, mysql_second, mysql_third)",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "mysql",
                                "mysql_second",
                                "mysql_third"
                            ]
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "invoice_number",
                                    "authorization_key",
                                    "amount"
                                ],
                                "properties": {
                                    "invoice_number": {
                                        "type": "string"
                                    },
                                    "authorization_key": {
                                        "type": "string"
                                    },
                                    "amount": {
                                        "type": "number",
                                        "format": "float"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Monto actualizado exitosamente"
                    },
                    "403": {
                        "description": "Clave de autorización inválida"
                    },
                    "404": {
                        "description": "Factura o contrato no encontrado"
                    },
                    "409": {
                        "description": "La factura no está pendiente"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments/{payment}": {
            "get": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Obtener pago",
                "operationId": "fd86d79f3a702c33951602a3a041954c",
                "parameters": [
                    {
                        "name": "payment",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Pago obtenido"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Actualizar pago",
                "operationId": "5e6ce68c765bfba967264070023c3122",
                "parameters": [
                    {
                        "name": "payment",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {}
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Pago actualizado"
                    },
                    "422": {
                        "description": "Datos inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Eliminar pago",
                "operationId": "10dde42bcf9365c33158aa3c769af513",
                "parameters": [
                    {
                        "name": "payment",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Pago eliminado"
                    },
                    "409": {
                        "description": "Pago completado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments/{payment}/process": {
            "post": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Procesar pago",
                "operationId": "9b1cd8a68d219d304f78335a2be52909",
                "parameters": [
                    {
                        "name": "payment",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Pago procesado"
                    },
                    "409": {
                        "description": "Estado inválido"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments/{payment}/cancel": {
            "post": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Cancelar pago",
                "operationId": "df65734621638b350727b4c4b3afcc6d",
                "parameters": [
                    {
                        "name": "payment",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Pago cancelado"
                    },
                    "409": {
                        "description": "Pago completado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments/{payment}/mark-failed": {
            "post": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Marcar pago como fallido",
                "operationId": "b0207c277a4ad5ac8a83afcc0764c17f",
                "parameters": [
                    {
                        "name": "payment",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Pago fallido"
                    },
                    "409": {
                        "description": "Pago completado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments/by-status": {
            "get": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Pagos por estado",
                "operationId": "fd75ff56706146f1f4c75b3974e908a4",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pending",
                                "processing",
                                "completed",
                                "failed",
                                "cancelled"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Listado de pagos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/payments/statistics": {
            "get": {
                "tags": [
                    "Pagos"
                ],
                "summary": "Estadísticas de pagos",
                "operationId": "fda8c4e32416a1f6da24bbdbbde50470",
                "responses": {
                    "200": {
                        "description": "Estadísticas"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "tags": [
        {
            "name": "Autenticación",
            "description": "Autenticación"
        },
        {
            "name": "Bancos",
            "description": "Bancos"
        },
        {
            "name": "BCV",
            "description": "BCV"
        },
        {
            "name": "Clientes",
            "description": "Clientes"
        },
        {
            "name": "Contratos",
            "description": "Contratos"
        },
        {
            "name": "Facturas",
            "description": "Facturas"
        },
        {
            "name": "Pagos",
            "description": "Pagos"
        }
    ]
}