{
    "openapi": "3.0.0",
    "info": {
        "title": "Dropi Api",
        "contact": {
            "email": "soporteti@dropi.co"
        },
        "version": "0.1"
    },
    "paths": {
        "/integrations/login": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Login para integraciones",
                "description": "Autentica un usuario y retorna un token JWT para usar en las demás peticiones de integrations",
                "operationId": "0266a02f8334eef53b6f3c20dd70bf42",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "password",
                                    "white_brand_id"
                                ],
                                "properties": {
                                    "email": {
                                        "description": "Email del usuario",
                                        "type": "string",
                                        "format": "email",
                                        "example": "usuario@ejemplo.com"
                                    },
                                    "password": {
                                        "description": "Contraseña del usuario",
                                        "type": "string",
                                        "format": "password",
                                        "example": "password123"
                                    },
                                    "white_brand_id": {
                                        "description": "ID de la marca blanca o token único de la marca blanca",
                                        "type": "string",
                                        "example": "1"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Login exitoso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "isSuccess": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Ha ingresado al sistema correctamente"
                                        },
                                        "status": {
                                            "type": "integer",
                                            "example": 200
                                        },
                                        "token": {
                                            "type": "string",
                                            "example": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Error en el login",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "isSuccess": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Usuario o contraseña incorrecta"
                                        },
                                        "error": {
                                            "type": "string",
                                            "example": "Usuario o contraseña incorrecta"
                                        },
                                        "status": {
                                            "type": "integer",
                                            "example": 400
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/integrations/whoiam": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Obtener información del usuario autenticado",
                "description": "Retorna la información del usuario autenticado mediante el token JWT",
                "operationId": "fbb48ffea77342bf763d43caeea8b986",
                "responses": {
                    "200": {
                        "description": "Información del usuario",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "example": 1
                                        },
                                        "name": {
                                            "type": "string",
                                            "example": "John"
                                        },
                                        "surname": {
                                            "type": "string",
                                            "example": "Doe"
                                        },
                                        "email": {
                                            "type": "string",
                                            "example": "usuario@ejemplo.com"
                                        },
                                        "phone": {
                                            "type": "string",
                                            "example": "+57 300 123 4567"
                                        },
                                        "status": {
                                            "type": "string",
                                            "example": "active"
                                        },
                                        "urlS3_logo": {
                                            "type": "string",
                                            "example": "https://s3.amazonaws.com/..."
                                        },
                                        "store_url": {
                                            "type": "string",
                                            "example": "https://mitienda.com"
                                        },
                                        "category_id": {
                                            "type": "integer",
                                            "example": 1
                                        },
                                        "category_name": {
                                            "type": "string",
                                            "example": "Dropshipper"
                                        },
                                        "wallets": {
                                            "type": "number",
                                            "format": "float",
                                            "example": 150000.5
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Token inválido o expirado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Token has expired"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Usuario no encontrado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "User not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearer": []
                    }
                ]
            }
        },
        "/api/register": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Es el metodo para registrar un usuario proveedor o dropshipper",
                "description": "Ejemplo del tipo de objecto que va en el cuerpo",
                "operationId": "register",
                "requestBody": {
                    "description": "Representación de una operación en dropi",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "surname",
                                    "email",
                                    "type_user",
                                    "password",
                                    "c_password",
                                    "phone",
                                    "cod_area_phone",
                                    "white_brand_id"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "example": "kevin"
                                    },
                                    "surname": {
                                        "type": "string",
                                        "example": "prueba"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "example@gmail.com"
                                    },
                                    "type_user": {
                                        "type": "string",
                                        "enum": [
                                            "SUPPLIER",
                                            "DROPSHIPPER"
                                        ],
                                        "example": "SUPPLIER"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "Password123."
                                    },
                                    "c_password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "Password123."
                                    },
                                    "phone": {
                                        "type": "string",
                                        "example": "123456789"
                                    },
                                    "cod_area_phone": {
                                        "type": "string",
                                        "example": "57"
                                    },
                                    "white_brand_id": {
                                        "type": "string",
                                        "example": ""
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Usuario creado con éxito"
                    },
                    "404": {
                        "description": "Could Not Find Resource"
                    },
                    "400": {
                        "description": "Bad Request"
                    }
                }
            }
        },
        "/api/orders/cancellationReasons": {
            "get": {
                "tags": [
                    "Cancelaciones"
                ],
                "summary": "Obtener motivos de cancelación",
                "description": "Devuelve una lista de motivos de cancelación según el rol del usuario autenticado.",
                "operationId": "289401b93faedd5eef303da70982bb73",
                "responses": {
                    "200": {
                        "description": "Motivos de cancelación obtenidos correctamente",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "isSuccess": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "objects": {
                                            "properties": {
                                                "Dropshipper": {
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "example": 1
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "example": "Datos incompletos"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                },
                                                "others": {
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "example": 8
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "example": "Publicidad engañosa"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Motivos de cancelación obtenidos correctamente"
                                        },
                                        "status": {
                                            "type": "integer",
                                            "example": 200
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Error interno del servidor",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "isSuccess": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "objects": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Ha ocurrido un error interno"
                                        },
                                        "status": {
                                            "type": "integer",
                                            "example": 500
                                        },
                                        "error": {
                                            "type": "string",
                                            "example": "Ha ocurrido un error interno"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": null,
                                            "nullable": true
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/categories": {
            "get": {
                "tags": [
                    "Products"
                ],
                "summary": "el api para obtener la lista de Categorías",
                "operationId": "index",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "isSuccess": {
                                            "type": "boolean"
                                        },
                                        "status": {
                                            "type": "integer"
                                        },
                                        "objects": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "The token could not be parsed from the request"
                    },
                    "404": {
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/users/{id}": {
            "get": {
                "tags": [
                    "Users"
                ],
                "summary": "Es el metodo para mostar un usuario por id",
                "description": "Ejemplo del tipo de parametro que va por la ruta",
                "operationId": "showUser",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "ID de usuario a mostrar",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "isSuccess": {
                                            "type": "boolean"
                                        },
                                        "status": {
                                            "type": "integer"
                                        },
                                        "objects": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "404": {
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/users/warehouses/{id}": {
            "get": {
                "tags": [
                    "Warehouses"
                ],
                "summary": "Es el metodo para mostrar una bodega por id",
                "description": "Ejemplo del tipo de parametro que va por la ruta",
                "operationId": "showWarehouse",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "ID de usuario a mostrar",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "isSuccess": {
                                            "type": "boolean"
                                        },
                                        "status": {
                                            "type": "integer"
                                        },
                                        "objects": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "The token could not be parsed from the request"
                    },
                    "404": {
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/users/warehouses": {
            "post": {
                "tags": [
                    "Warehouses"
                ],
                "summary": "Es el metodo para registrar un usuario proveedor o dropshipper",
                "description": "Ejemplo del tipo de objecto que va en el cuerpo",
                "operationId": "store",
                "requestBody": {
                    "description": "Representación de una operación en dropi",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/RegisterWarehouseSchema"
                            },
                            "examples": {
                                "Default register warehouse": {
                                    "summary": "Default register warehouse",
                                    "value": {
                                        "name": "",
                                        "phone": "",
                                        "address": "",
                                        "city_id": null,
                                        "user_id": null,
                                        "zip_code": null
                                    }
                                },
                                "Register for warehouse": {
                                    "summary": "Register for warehouse",
                                    "value": {
                                        "name": "bodega prueba",
                                        "phone": "123456789",
                                        "address": "carrera 19 #20-30",
                                        "city_id": 1,
                                        "user_id": 5,
                                        "zip_code": null
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Bodega creada con éxito"
                    },
                    "404": {
                        "description": "Could Not Find Resource"
                    },
                    "400": {
                        "description": "Bad Request"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "RegisterWarehouseSchema": {
                "type": "object",
                "allOf": [
                    {
                        "$ref": "#/components/schemas/RegisterWarehouseSchema"
                    },
                    {
                        "required": [
                            "name"
                        ],
                        "properties": {
                            "name": {
                                "description": "el nombre de la bodega",
                                "type": "string",
                                "maxLength": 80,
                                "example": "Bodega sucursal"
                            }
                        },
                        "type": "object"
                    },
                    {
                        "required": [
                            "phone"
                        ],
                        "properties": {
                            "phone": {
                                "description": "el telefono de la bodega",
                                "type": "string",
                                "maxLength": 80,
                                "example": "123456789"
                            }
                        },
                        "type": "object"
                    },
                    {
                        "required": [
                            "address"
                        ],
                        "properties": {
                            "address": {
                                "description": "direccion de la bodega",
                                "type": "string",
                                "maxLength": 200,
                                "example": "carrera 18 #12-23"
                            }
                        },
                        "type": "object"
                    },
                    {
                        "required": [
                            "city_id"
                        ],
                        "properties": {
                            "city_id": {
                                "description": "id de la ciudad en dropi",
                                "type": "number",
                                "example": "1"
                            }
                        },
                        "type": "object"
                    },
                    {
                        "required": [
                            "user_id"
                        ],
                        "properties": {
                            "user_id": {
                                "description": "id del usuario dueño de la bodega(proveedor)",
                                "type": "number",
                                "example": "5"
                            }
                        },
                        "type": "object"
                    },
                    {
                        "properties": {
                            "zip_code": {
                                "description": "codigo dane donde esta la bodega",
                                "type": "string",
                                "maxLength": 6,
                                "example": "45895"
                            }
                        },
                        "type": "object"
                    }
                ]
            },
            "User StoreData": {
                "required": [
                    "store_name",
                    "store_email",
                    "store_url",
                    "store_phone",
                    "default_order_state"
                ],
                "properties": {
                    "store_name": {
                        "type": "string",
                        "example": "Mi Tienda"
                    },
                    "store_email": {
                        "type": "string",
                        "example": "tienda@email.com"
                    },
                    "store_url": {
                        "type": "string",
                        "example": "https://mitienda.com"
                    },
                    "store_phone": {
                        "type": "string",
                        "example": "3001234567"
                    },
                    "default_order_state": {
                        "type": "string",
                        "example": "PENDIENTE"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "name": "bearerAuth",
                "in": "header",
                "bearerFormat": "JWT",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Authentication",
            "description": "User related operations"
        },
        {
            "name": "Users",
            "description": "User related operations"
        },
        {
            "name": "Products",
            "description": "Modulo completo para productos"
        },
        {
            "name": "Warehouses",
            "description": "Modulo completo para las bodegas"
        },
        {
            "name": "Cancelaciones",
            "description": "Cancelaciones"
        }
    ]
}