{
    "openapi": "3.0.0",
    "info": {
        "title": "APP FIVI API",
        "description": "API REST del sistema de gestión FIVI (montacargas)",
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "http://localhost",
            "description": "Servidor principal"
        }
    ],
    "paths": {
        "/api/auth/login": {
            "post": {
                "tags": [
                    "Autenticación"
                ],
                "summary": "Iniciar sesión y obtener token JWT",
                "operationId": "68c5cab6a386991c65ac59f24f9695a2",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "password"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "admin@fivi.com"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "secret123"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Login exitoso"
                    },
                    "401": {
                        "description": "Credenciales inválidas"
                    }
                }
            }
        },
        "/api/auth/logout": {
            "post": {
                "tags": [
                    "Autenticación"
                ],
                "summary": "Cerrar sesión e invalidar token",
                "operationId": "a03f1137c4c903d1965e492c020f7ff6",
                "responses": {
                    "200": {
                        "description": "Sesión cerrada correctamente"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/auth/me": {
            "get": {
                "tags": [
                    "Autenticación"
                ],
                "summary": "Obtener datos del usuario autenticado",
                "operationId": "3d3b0a70b8aa585c13fb3383dbe55cda",
                "responses": {
                    "200": {
                        "description": "Datos del usuario"
                    },
                    "401": {
                        "description": "No autenticado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/invoices": {
            "get": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Listar facturas paginadas",
                "operationId": "42d8b48335f3c041afb675e2d6006461",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Máx 100",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 15
                        }
                    },
                    {
                        "name": "folio",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "serie",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "seller_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status_id",
                        "in": "query",
                        "description": "1=Iniciada 2=Emitida 3=Cancelada 4=EntregaParcial 5=Entregada",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "fecha_desde",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "example": "2026-01-01"
                        }
                    },
                    {
                        "name": "fecha_hasta",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "example": "2026-12-31"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Lista de facturas paginada"
                    },
                    "401": {
                        "description": "No autenticado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/invoices/{id}": {
            "get": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Obtener detalle completo de una factura",
                "operationId": "a582760d7f56ab77bc862107b603f00b",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "ID de la factura",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Detalle completo de la factura",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "uuid": {
                                            "type": "string"
                                        },
                                        "serie": {
                                            "type": "string"
                                        },
                                        "folio": {
                                            "type": "string"
                                        },
                                        "fecha": {
                                            "type": "string",
                                            "format": "date"
                                        },
                                        "dateTimbrado": {
                                            "type": "string"
                                        },
                                        "fechaVencimiento": {
                                            "type": "string",
                                            "format": "date",
                                            "nullable": true
                                        },
                                        "subtotal": {
                                            "type": "number"
                                        },
                                        "descuento": {
                                            "type": "number"
                                        },
                                        "amount": {
                                            "type": "number"
                                        },
                                        "exchangeRate": {
                                            "type": "number"
                                        },
                                        "observations": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "purchaseOrderClientNumber": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "statusId": {
                                            "type": "integer"
                                        },
                                        "statusName": {
                                            "type": "string"
                                        },
                                        "clientId": {
                                            "type": "integer"
                                        },
                                        "clientName": {
                                            "type": "string"
                                        },
                                        "clientRfc": {
                                            "type": "string"
                                        },
                                        "currencyId": {
                                            "type": "integer"
                                        },
                                        "currencyKey": {
                                            "type": "string"
                                        },
                                        "paymentTypeId": {
                                            "type": "integer",
                                            "nullable": true
                                        },
                                        "paymentTypeName": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "paymentTypeKey": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "paymentMethodId": {
                                            "type": "integer",
                                            "nullable": true
                                        },
                                        "paymentMethodName": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "paymentMethodKey": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "cfdiUsageId": {
                                            "type": "integer",
                                            "nullable": true
                                        },
                                        "cfdiUsageName": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "cfdiUsageKey": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "sellerId": {
                                            "type": "integer",
                                            "nullable": true
                                        },
                                        "sellerName": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "quoteId": {
                                            "type": "integer",
                                            "nullable": true
                                        },
                                        "quoteSerieFolio": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "details": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "productId": {
                                                        "type": "integer"
                                                    },
                                                    "productName": {
                                                        "type": "string"
                                                    },
                                                    "productModel": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "claveProdServ": {
                                                        "type": "string"
                                                    },
                                                    "claveUnidad": {
                                                        "type": "string"
                                                    },
                                                    "description": {
                                                        "type": "string"
                                                    },
                                                    "anotherDescription": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "quantity": {
                                                        "type": "number"
                                                    },
                                                    "unitValue": {
                                                        "type": "number"
                                                    },
                                                    "descuento": {
                                                        "type": "number"
                                                    },
                                                    "subtotal": {
                                                        "type": "number"
                                                    },
                                                    "ivaAmount": {
                                                        "type": "number"
                                                    },
                                                    "iepsAmount": {
                                                        "type": "number"
                                                    },
                                                    "isrAmount": {
                                                        "type": "number"
                                                    },
                                                    "ivaRetentionAmount": {
                                                        "type": "number"
                                                    },
                                                    "total": {
                                                        "type": "number"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Factura no encontrada"
                    },
                    "401": {
                        "description": "No autenticado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "bearerFormat": "JWT",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Autenticación",
            "description": "Autenticación"
        },
        {
            "name": "Facturas",
            "description": "Facturas"
        }
    ]
}