{
    "openapi": "3.0.0",
    "info": {
        "title": "Longometal API",
        "description": "Documentation OpenAPI pour l'ensemble des endpoints (auth, clients, scoring, plafonds, alertes, incidents, limites assureur...).",
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "/api",
            "description": "API base path"
        }
    ],
    "paths": {
        "/activites": {
            "get": {
                "tags": [
                    "Activites"
                ],
                "summary": "List activites",
                "operationId": "c22a4964f4b93534d241c4b5358741cc",
                "parameters": [
                    {
                        "name": "active_only",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List"
                    }
                }
            },
            "post": {
                "tags": [
                    "Activites"
                ],
                "summary": "Create activity",
                "operationId": "acca802abccc250267bbfa0bf4bfb12f",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "label"
                                ],
                                "properties": {
                                    "label": {
                                        "type": "string",
                                        "example": "Industry"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "example": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created"
                    },
                    "409": {
                        "description": "Conflict"
                    }
                }
            }
        },
        "/activites/{id}": {
            "get": {
                "tags": [
                    "Activites"
                ],
                "summary": "Get activity",
                "operationId": "1c7876ce64ffb783821dbde4907a44ae",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Found"
                    },
                    "404": {
                        "description": "Not found"
                    }
                }
            },
            "put": {
                "tags": [
                    "Activites"
                ],
                "summary": "Update activity",
                "operationId": "fce69a4b144c9f6d4903c076313e0f67",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "label": {
                                        "type": "string",
                                        "example": "Industry and Services"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "example": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated"
                    },
                    "409": {
                        "description": "Conflict"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Activites"
                ],
                "summary": "Delete activity",
                "operationId": "6156879f00e32b30640fcfa9b998adf0",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Deleted"
                    },
                    "409": {
                        "description": "Conflict"
                    }
                }
            }
        },
        "/alerts": {
            "get": {
                "tags": [
                    "Alerts"
                ],
                "summary": "Lister les alertes",
                "operationId": "761f6279117c3162bb673a3db335196b",
                "parameters": [
                    {
                        "name": "criticality",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "MINOR",
                                "MAJOR",
                                "CRITICAL"
                            ]
                        }
                    },
                    {
                        "name": "sourceType",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "seen",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Liste paginée"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Alerts"
                ],
                "summary": "Créer une alerte",
                "operationId": "da90d001c754180408bfd0f756fff911",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Créée"
                    },
                    "200": {
                        "description": "Existante renvoyée"
                    },
                    "422": {
                        "description": "Erreur de validation"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/alerts/{id}": {
            "get": {
                "tags": [
                    "Alerts"
                ],
                "summary": "Afficher une alerte",
                "operationId": "709bbf7193bdc907ecfe8250d74262bd",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Alerte"
                    },
                    "404": {
                        "description": "Non trouvée"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Alerts"
                ],
                "summary": "Mettre à jour une alerte",
                "operationId": "895bdd9e8daa79a4ccc24c138ce7bb53",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Mise à jour"
                    },
                    "403": {
                        "description": "Alerte auto non modifiable"
                    },
                    "404": {
                        "description": "Non trouvée"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/alerts/{id}/seen": {
            "patch": {
                "tags": [
                    "Alerts"
                ],
                "summary": "Marquer une alerte comme vue",
                "operationId": "5f5e403a50d67c3a0a9074010eb08580",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Marquée vue"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/auth/register": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Register a new user",
                "operationId": "08136088c4862c313b35d6518bab8d3a",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "first_name",
                                    "last_name",
                                    "email",
                                    "password",
                                    "password_confirmation",
                                    "role"
                                ],
                                "properties": {
                                    "first_name": {
                                        "type": "string",
                                        "example": "Jane"
                                    },
                                    "last_name": {
                                        "type": "string",
                                        "example": "Doe"
                                    },
                                    "role": {
                                        "type": "string",
                                        "enum": [
                                            "Administrateur",
                                            "ResponsableRecouvrement",
                                            "AgentRecouvrement"
                                        ],
                                        "example": "ResponsableRecouvrement"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "jane@example.com"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "secret123"
                                    },
                                    "password_confirmation": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "secret123"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Registration successful",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Registration successful."
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/AuthData"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error"
                    }
                }
            }
        },
        "/auth/login": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Authenticate user",
                "operationId": "99d66635c4992aeaa6aa44ff653d0563",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "password"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "jane@example.com"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "secret123"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Login successful",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Login successful."
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/AuthData"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid credentials"
                    },
                    "422": {
                        "description": "Validation error"
                    }
                }
            }
        },
        "/auth/forgot-password": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Send password reset link",
                "operationId": "fea89d2766defe4ad877001920e3f289",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "jane@example.com"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Reset link sent",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Password reset link sent."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error"
                    }
                }
            }
        },
        "/auth/reset-password": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Reset password using token",
                "operationId": "b8d03d5b689dcb65d3771f62d4f90a24",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "password",
                                    "password_confirmation",
                                    "token"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "jane@example.com"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "newSecret123"
                                    },
                                    "password_confirmation": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "newSecret123"
                                    },
                                    "token": {
                                        "type": "string",
                                        "example": "reset-token-from-email"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Password reset",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Password has been reset."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Invalid token or validation error"
                    }
                }
            }
        },
        "/auth/change-password": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Change password for authenticated user",
                "operationId": "392f5b8efb38f64f049872d18d481cf1",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "current_password",
                                    "password",
                                    "password_confirmation"
                                ],
                                "properties": {
                                    "current_password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "oldSecret123"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "newSecret123"
                                    },
                                    "password_confirmation": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "newSecret123"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Password changed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Password updated successfully."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "422": {
                        "description": "Validation error"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/auth/me": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "Get the authenticated user",
                "operationId": "7edae2cdbaafc10dff8c9c4198b320a2",
                "responses": {
                    "200": {
                        "description": "User data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "user": {
                                                    "$ref": "#/components/schemas/User"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/clients": {
            "get": {
                "tags": [
                    "Clients"
                ],
                "summary": "List clients",
                "operationId": "6536f8d22d25758c3e14dbbe8e228af0",
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "raison_sociale",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "ice",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "ville",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "activite_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated list"
                    }
                }
            },
            "post": {
                "tags": [
                    "Clients"
                ],
                "summary": "Create client",
                "operationId": "74a35b85418e09c2489915865dd22445",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "raison_sociale"
                                ],
                                "properties": {
                                    "date_creation": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "raison_sociale": {
                                        "type": "string"
                                    },
                                    "forme_juridique": {
                                        "type": "string"
                                    },
                                    "ice": {
                                        "type": "string"
                                    },
                                    "rc": {
                                        "type": "string"
                                    },
                                    "id_fiscal": {
                                        "type": "string"
                                    },
                                    "patente": {
                                        "type": "string"
                                    },
                                    "id_sap": {
                                        "type": "string"
                                    },
                                    "activite_id": {
                                        "type": "integer"
                                    },
                                    "adresse": {
                                        "type": "string"
                                    },
                                    "ville": {
                                        "type": "string"
                                    },
                                    "tribunal": {
                                        "type": "string"
                                    },
                                    "avatar": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "contacts": {
                                        "type": "array",
                                        "items": {
                                            "properties": {
                                                "responsable": {
                                                    "type": "string"
                                                },
                                                "cin": {
                                                    "type": "string"
                                                },
                                                "fonction": {
                                                    "type": "string"
                                                },
                                                "telephone": {
                                                    "type": "string"
                                                },
                                                "mail": {
                                                    "type": "string",
                                                    "format": "email"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created"
                    },
                    "409": {
                        "description": "Conflict"
                    }
                }
            }
        },
        "/clients/{id}": {
            "get": {
                "tags": [
                    "Clients"
                ],
                "summary": "Get client",
                "operationId": "1837c830668b0f7aa87761172e9a8cf9",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Found"
                    },
                    "404": {
                        "description": "Not found"
                    }
                }
            },
            "put": {
                "tags": [
                    "Clients"
                ],
                "summary": "Update client",
                "operationId": "1ee17ab59b59dd0a816f385b724d2b6c",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "date_creation": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "raison_sociale": {
                                        "type": "string"
                                    },
                                    "forme_juridique": {
                                        "type": "string"
                                    },
                                    "ice": {
                                        "type": "string"
                                    },
                                    "rc": {
                                        "type": "string"
                                    },
                                    "id_fiscal": {
                                        "type": "string"
                                    },
                                    "patente": {
                                        "type": "string"
                                    },
                                    "id_sap": {
                                        "type": "string"
                                    },
                                    "activite_id": {
                                        "type": "integer"
                                    },
                                    "adresse": {
                                        "type": "string"
                                    },
                                    "ville": {
                                        "type": "string"
                                    },
                                    "tribunal": {
                                        "type": "string"
                                    },
                                    "avatar": {
                                        "type": "string",
                                        "format": "binary"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Clients"
                ],
                "summary": "Delete client",
                "operationId": "3505fe07e8722ba21177850f874211f2",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Deleted"
                    }
                }
            }
        },
        "/clients/{id}/contacts": {
            "post": {
                "tags": [
                    "Clients"
                ],
                "summary": "Add contact to client",
                "operationId": "dffb2460f520d9fbaccfbfe32b724ee0",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created"
                    }
                }
            }
        },
        "/contacts/{contactId}": {
            "put": {
                "tags": [
                    "Clients"
                ],
                "summary": "Update contact",
                "operationId": "dae5076b33d18c647da6834016c63e1d",
                "parameters": [
                    {
                        "name": "contactId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Updated"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Clients"
                ],
                "summary": "Delete contact",
                "operationId": "e81e387cae5f58aeade2ed08351cd181",
                "parameters": [
                    {
                        "name": "contactId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Deleted"
                    }
                }
            }
        },
        "/clients/{id}/status": {
            "patch": {
                "tags": [
                    "Clients"
                ],
                "summary": "Update client status",
                "operationId": "ec3c93d4c81b34a6f3aa0ecf788d8dbb",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "status"
                                ],
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "Actif",
                                            "Inactif",
                                            "Suspendu"
                                        ]
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Status updated"
                    },
                    "422": {
                        "description": "Validation error"
                    }
                }
            }
        },
        "/criteria": {
            "get": {
                "tags": [
                    "Criteria"
                ],
                "summary": "Lister les critères",
                "operationId": "0e78184355e007c4bee3fc8dbf9160c9",
                "parameters": [
                    {
                        "name": "section_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Liste des critères"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Criteria"
                ],
                "summary": "Créer un critère",
                "operationId": "96c1e3b46885556ac5858a157e930347",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Créé"
                    },
                    "422": {
                        "description": "Erreur de validation"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/criteria/{id}": {
            "get": {
                "tags": [
                    "Criteria"
                ],
                "summary": "Afficher un critère",
                "operationId": "76d89aee506e6e6bade50b7977d6f5ff",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Critère"
                    },
                    "404": {
                        "description": "Non trouvé"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Criteria"
                ],
                "summary": "Mettre à jour un critère",
                "operationId": "0e99e7d9b8c85609a63b86bac87d85be",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Mis à jour"
                    },
                    "404": {
                        "description": "Non trouvé"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Criteria"
                ],
                "summary": "Supprimer (soft delete) un critère",
                "operationId": "e46b94a823588d84aa00b543d195d902",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Supprimé"
                    },
                    "404": {
                        "description": "Non trouvé"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/clients/{client}/incidents": {
            "get": {
                "tags": [
                    "Incidents"
                ],
                "summary": "Lister les incidents d'un client",
                "operationId": "a03dc95d6f8d80b95a3e0ec73155b34e",
                "parameters": [
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "incident_type",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "incident_reason",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Liste paginée"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Incidents"
                ],
                "summary": "Créer un incident",
                "operationId": "e62230c86fc7fcec4e0a2af7a7ed8de7",
                "parameters": [
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Créé"
                    },
                    "422": {
                        "description": "Erreur de validation"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/incidents/{incident}": {
            "put": {
                "tags": [
                    "Incidents"
                ],
                "summary": "Mettre à jour un incident",
                "operationId": "9b9730b1f226ef23769ea2daa88a7a39",
                "parameters": [
                    {
                        "name": "incident",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Mis à jour"
                    },
                    "404": {
                        "description": "Non trouvé"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/clients/{client}/insurer-limits": {
            "get": {
                "tags": [
                    "InsurerLimits"
                ],
                "summary": "Lister les crédits assureur d'un client",
                "operationId": "8cf08c509d262f2032cf8490bbd6d1eb",
                "parameters": [
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 20
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Liste paginée"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "InsurerLimits"
                ],
                "summary": "Créer un crédit assureur",
                "operationId": "0d10e5d92ad6fc6de96427cc01ae00b3",
                "parameters": [
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "insurer_name": {
                                        "type": "string",
                                        "example": "AXA"
                                    },
                                    "insurer_status": {
                                        "type": "string",
                                        "example": "Accorde"
                                    },
                                    "credit_amount": {
                                        "type": "number",
                                        "format": "float",
                                        "example": 500
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Créé"
                    },
                    "422": {
                        "description": "Erreur de validation"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/overdraft-calculations": {
            "get": {
                "tags": [
                    "Overdrafts"
                ],
                "summary": "Lister les plafonds calculés",
                "operationId": "1f21f2be7586df018e3e3f05783eb5f3",
                "parameters": [
                    {
                        "name": "client_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "category_code",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "sort_by",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "calculated_at",
                                "limite_bilancielle",
                                "limite_potentielle",
                                "limite_assureur",
                                "id"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Liste paginée"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Overdrafts"
                ],
                "summary": "Calculer un nouveau plafond découvert",
                "operationId": "3505baf2d8ddd34e96e5b4191bdc75da",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Créé"
                    },
                    "422": {
                        "description": "Validation ou absence de scoring"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/overdraft-calculations/{id}": {
            "get": {
                "tags": [
                    "Overdrafts"
                ],
                "summary": "Afficher un plafond calculé",
                "operationId": "59a06b7529762d0ddb1d81de7d11ac14",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Détail"
                    },
                    "404": {
                        "description": "Non trouvé"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/clients/{client}/potential-evaluations/latest": {
            "get": {
                "tags": [
                    "PotentialEvaluations"
                ],
                "summary": "Dernière limite potentielle d'un client",
                "operationId": "74efe69a4bbe464f0016de313e201d6b",
                "parameters": [
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Dernière limite ou null"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/potential-evaluations": {
            "post": {
                "tags": [
                    "PotentialEvaluations"
                ],
                "summary": "Calculer la limite potentielle",
                "operationId": "43a81e6c9ebc71ecdb5d7ffee4313372",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Calculé"
                    },
                    "422": {
                        "description": "Erreur de validation ou limite bilancielle manquante"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/sections": {
            "get": {
                "tags": [
                    "Sections"
                ],
                "summary": "List active sections",
                "operationId": "ea2cc64b071fcc649469913ac9e6f1a9",
                "responses": {
                    "200": {
                        "description": "List of sections",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "properties": {
                                            "id": {
                                                "type": "integer",
                                                "example": 1
                                            },
                                            "code": {
                                                "type": "string",
                                                "example": "FIN"
                                            },
                                            "label": {
                                                "type": "string",
                                                "example": "Financier"
                                            },
                                            "order": {
                                                "type": "integer",
                                                "example": 1
                                            }
                                        },
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/users": {
            "get": {
                "tags": [
                    "Users"
                ],
                "summary": "Lister les utilisateurs",
                "operationId": "7208c29037df2b8bb02499ba39ed8a78",
                "parameters": [
                    {
                        "name": "email",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "first_name",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "last_name",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Liste paginée"
                    }
                }
            }
        },
        "/users/{id}/status": {
            "patch": {
                "tags": [
                    "Users"
                ],
                "summary": "Activer ou désactiver un compte utilisateur",
                "operationId": "9233adaae8a8693c35c367c080f62eff",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "is_active"
                                ],
                                "properties": {
                                    "is_active": {
                                        "type": "boolean",
                                        "example": false
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Statut mis à jour"
                    },
                    "403": {
                        "description": "Accès interdit"
                    },
                    "422": {
                        "description": "Erreur de validation"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "User": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1
                    },
                    "first_name": {
                        "type": "string",
                        "example": "Jane"
                    },
                    "last_name": {
                        "type": "string",
                        "example": "Doe"
                    },
                    "role": {
                        "type": "string",
                        "example": "ResponsableRecouvrement"
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "example": "jane@example.com"
                    },
                    "is_active": {
                        "type": "boolean",
                        "example": true
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2024-01-01T12:00:00Z"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2024-01-01T12:00:00Z"
                    }
                },
                "type": "object"
            },
            "AuthData": {
                "properties": {
                    "token": {
                        "type": "string",
                        "example": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9"
                    },
                    "token_type": {
                        "type": "string",
                        "example": "bearer"
                    },
                    "expires_in": {
                        "type": "integer",
                        "example": 3600
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "bearerFormat": "JWT",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Activites",
            "description": "Activity management"
        },
        {
            "name": "Alerts",
            "description": "Gestion des alertes"
        },
        {
            "name": "Auth",
            "description": "Authentication endpoints"
        },
        {
            "name": "Clients",
            "description": "Client management"
        },
        {
            "name": "Criteria",
            "description": "Gestion des critères de scoring"
        },
        {
            "name": "Incidents",
            "description": "Incidents clients"
        },
        {
            "name": "InsurerLimits",
            "description": "Limites de crédit assureur"
        },
        {
            "name": "Overdrafts",
            "description": "Plafond découvert (limite bilancielle)"
        },
        {
            "name": "PotentialEvaluations",
            "description": "Limite potentielle"
        },
        {
            "name": "Sections",
            "description": "Static sections used in scoring configuration"
        },
        {
            "name": "Users",
            "description": "Gestion des utilisateurs"
        }
    ]
}
