{
  "openapi": "3.1.0",
  "info": {
    "title": "Djinn Document Extract",
    "description": "Extraction de données structurées depuis factures, reçus, CVs, IDs et RIBs",
    "version": "0.2.0"
  },
  "paths": {
    "/health": {
      "get": {
        "summary": "Health",
        "description": "Health check endpoint.",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/schemas": {
      "get": {
        "summary": "Schemas",
        "description": "List all supported document schemas with their fields.",
        "operationId": "schemas_v1_schemas_get",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SchemaInfo"
                  },
                  "title": "Response Schemas V1 Schemas Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/extract": {
      "post": {
        "summary": "Extract",
        "description": "Extract structured data from a single uploaded file.",
        "operationId": "extract_v1_extract_post",
        "parameters": [
          {
            "name": "document_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/DocumentType"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Document Type"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_extract_v1_extract_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExtractionResult"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/extract/batch": {
      "post": {
        "summary": "Extract Batch",
        "description": "Extract structured data from multiple uploaded files.",
        "operationId": "extract_batch_v1_extract_batch_post",
        "parameters": [
          {
            "name": "document_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/DocumentType"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Document Type"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_extract_batch_v1_extract_batch_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExtractionResult"
                  },
                  "title": "Response Extract Batch V1 Extract Batch Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/receipt-policies": {
      "get": {
        "summary": "Get Receipt Policy V1",
        "description": "Politique de dépenses du tenant authentifié, ou la politique par défaut.",
        "operationId": "get_receipt_policy_v1_v1_receipt_policies_get",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePolicyOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Put Receipt Policy V1",
        "description": "Remplace la politique du tenant authentifié.\n\nLe tenant vient de l'authentification (ADR-001) ; un `tenant_id` présent\ndans le corps est ignoré, jamais honoré.",
        "operationId": "put_receipt_policy_v1_v1_receipt_policies_put",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePolicy"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePolicyOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/extract/receipts/analyze": {
      "post": {
        "summary": "Analyze Receipts",
        "description": "Analyse un lot de reçus : doublons, écarts de politique, cohérence, authenticité.\n\nPour chaque reçu : extraction (`document_type=\"receipt\"`), empreinte\nperceptuelle, contrôle de cohérence interne, confrontation à la\npolitique de dépenses du tenant, et avis d'authenticité de `doc-trust`\n(la clé de l'appelant lui est transmise telle quelle, ADR-023 ; au plus\n4 appels simultanés par lot). Puis, sur l'ensemble du lot,\nrapprochement des doublons.\n\n**`findings` et `authenticity` sont des évaluations, jamais des\nautorisations** : cette route ne bloque rien, ne rejette aucun reçu pour\ncause de constat, et ne modifie aucune politique. Un fichier illisible,\ntrop volumineux, ou dont l'extraction échoue, produit un item avec\n`error` renseigné et n'interrompt jamais le lot — même contrat que\n`/v1/extract/batch`. Seul un problème de *requête* (lot vide, lot\nau-delà de `MAX_BATCH_RECEIPTS`) fait échouer l'appel entier.\n\n`authenticity` vaut `null` quand l'avis n'a pas pu être obtenu (doc-trust\nindisponible, format non pris en charge) : « non évalué », jamais « aucun\nsignal ». Cet échec n'interrompt pas le lot.",
        "operationId": "analyze_receipts_v1_extract_receipts_analyze_post",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_analyze_receipts_v1_extract_receipts_analyze_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptAnalysisResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AuthenticityOut": {
        "properties": {
          "score": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Score"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "consistent",
              "suspicious",
              "inconsistent"
            ],
            "title": "Verdict"
          },
          "rules_version": {
            "type": "string",
            "title": "Rules Version"
          },
          "signals": {
            "items": {
              "$ref": "#/components/schemas/FindingOut"
            },
            "type": "array",
            "title": "Signals"
          },
          "explanation": {
            "type": "string",
            "title": "Explanation",
            "default": ""
          }
        },
        "type": "object",
        "required": [
          "score",
          "verdict",
          "rules_version"
        ],
        "title": "AuthenticityOut",
        "description": "Avis d'authenticité d'un reçu, rendu par doc-trust.\n\nUne aide au tri humain, jamais une preuve : ces signaux sont indicatifs et\ncontournables, et ne concluent rien sur le document. `verdict` reprend le\nvocabulaire doc-trust (`consistent`, `suspicious` = à vérifier,\n`inconsistent` = incohérent), jamais « faux »."
      },
      "Body_analyze_receipts_v1_extract_receipts_analyze_post": {
        "properties": {
          "files": {
            "items": {
              "type": "string",
              "contentMediaType": "application/octet-stream"
            },
            "type": "array",
            "title": "Files"
          },
          "categories": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Categories"
          }
        },
        "type": "object",
        "required": [
          "files"
        ],
        "title": "Body_analyze_receipts_v1_extract_receipts_analyze_post"
      },
      "Body_extract_batch_v1_extract_batch_post": {
        "properties": {
          "files": {
            "items": {
              "type": "string",
              "contentMediaType": "application/octet-stream"
            },
            "type": "array",
            "title": "Files"
          }
        },
        "type": "object",
        "required": [
          "files"
        ],
        "title": "Body_extract_batch_v1_extract_batch_post"
      },
      "Body_extract_v1_extract_post": {
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "File"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_extract_v1_extract_post"
      },
      "Certification": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "provider": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider"
          },
          "year": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Year"
          }
        },
        "type": "object",
        "title": "Certification"
      },
      "Diploma": {
        "properties": {
          "school": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "School"
          },
          "degree": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Degree"
          },
          "field_of_study": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Field Of Study"
          },
          "start_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Date"
          },
          "end_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End Date"
          }
        },
        "type": "object",
        "title": "Diploma"
      },
      "DocumentType": {
        "type": "string",
        "enum": [
          "invoice",
          "receipt",
          "resume",
          "id_card",
          "rib"
        ],
        "title": "DocumentType"
      },
      "DuplicateGroupOut": {
        "properties": {
          "indices": {
            "items": {
              "type": "integer"
            },
            "type": "array",
            "title": "Indices"
          },
          "rule": {
            "type": "string",
            "enum": [
              "fingerprint",
              "vendor_date_amount"
            ],
            "title": "Rule"
          }
        },
        "type": "object",
        "required": [
          "indices",
          "rule"
        ],
        "title": "DuplicateGroupOut",
        "description": "Groupe de reçus du lot jugés être le même achat, par empreinte ou par faits métier."
      },
      "ExpenseCap": {
        "properties": {
          "category": {
            "type": "string",
            "maxLength": 64,
            "minLength": 1,
            "title": "Category"
          },
          "max_amount": {
            "type": "number",
            "minimum": 0.0,
            "title": "Max Amount"
          }
        },
        "type": "object",
        "required": [
          "category",
          "max_amount"
        ],
        "title": "ExpenseCap",
        "description": "Plafond pour une catégorie de dépense fournie par l'appelant."
      },
      "ExpensePolicy": {
        "properties": {
          "currency": {
            "type": "string",
            "maxLength": 3,
            "minLength": 3,
            "title": "Currency",
            "default": "EUR"
          },
          "default_max_amount": {
            "type": "number",
            "minimum": 0.0,
            "title": "Default Max Amount",
            "default": 1000.0
          },
          "caps": {
            "items": {
              "$ref": "#/components/schemas/ExpenseCap"
            },
            "type": "array",
            "title": "Caps"
          },
          "require_vat_above": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Require Vat Above"
          }
        },
        "type": "object",
        "title": "ExpensePolicy",
        "description": "Politique de dépenses d'un tenant.\n\nLe verdict produit à partir de cette politique est une **évaluation**,\njamais une autorisation : doc-extract ne refuse aucun remboursement, il\nrapporte qu'un montant dépasse un plafond déclaré."
      },
      "ExpensePolicyOut": {
        "properties": {
          "currency": {
            "type": "string",
            "maxLength": 3,
            "minLength": 3,
            "title": "Currency",
            "default": "EUR"
          },
          "default_max_amount": {
            "type": "number",
            "minimum": 0.0,
            "title": "Default Max Amount",
            "default": 1000.0
          },
          "caps": {
            "items": {
              "$ref": "#/components/schemas/ExpenseCap"
            },
            "type": "array",
            "title": "Caps"
          },
          "require_vat_above": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Require Vat Above"
          },
          "is_default": {
            "type": "boolean",
            "title": "Is Default",
            "default": false
          }
        },
        "type": "object",
        "title": "ExpensePolicyOut",
        "description": "Politique renvoyée par l'API, avec l'indication qu'aucune n'a été enregistrée."
      },
      "Experience": {
        "properties": {
          "company": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Company"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          },
          "location": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Location"
          },
          "start_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Date",
            "description": "YYYY-MM or YYYY"
          },
          "end_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End Date",
            "description": "YYYY-MM, YYYY, or 'Present'"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          }
        },
        "type": "object",
        "title": "Experience"
      },
      "ExtractionResult": {
        "properties": {
          "document_type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "data": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InvoiceData"
              },
              {
                "$ref": "#/components/schemas/ReceiptData"
              },
              {
                "$ref": "#/components/schemas/ResumeData"
              },
              {
                "$ref": "#/components/schemas/IDCardData"
              },
              {
                "$ref": "#/components/schemas/RibData"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data"
          },
          "text_source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TextSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "raw_text": {
            "type": "string",
            "title": "Raw Text"
          },
          "confidence": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Confidence"
          },
          "field_confidences": {
            "items": {
              "$ref": "#/components/schemas/FieldConfidence"
            },
            "type": "array",
            "title": "Field Confidences"
          },
          "pii_detected": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pii Detected"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          }
        },
        "type": "object",
        "required": [
          "document_type",
          "raw_text",
          "confidence"
        ],
        "title": "ExtractionResult"
      },
      "FieldConfidence": {
        "properties": {
          "field": {
            "type": "string",
            "title": "Field"
          },
          "score": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Score"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "type": "object",
        "required": [
          "field",
          "score"
        ],
        "title": "FieldConfidence"
      },
      "FindingOut": {
        "properties": {
          "code": {
            "type": "string",
            "title": "Code"
          },
          "message": {
            "type": "string",
            "title": "Message"
          },
          "severity": {
            "type": "string",
            "enum": [
              "info",
              "warning"
            ],
            "title": "Severity"
          }
        },
        "type": "object",
        "required": [
          "code",
          "message",
          "severity"
        ],
        "title": "FindingOut",
        "description": "Une observation sur un reçu, telle que renvoyée par l'API. Ni verdict, ni accusation."
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "HealthResponse": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "default": "ok"
          },
          "version": {
            "type": "string",
            "title": "Version",
            "default": "0.2.0"
          }
        },
        "type": "object",
        "title": "HealthResponse",
        "description": "Response model for the health check endpoint."
      },
      "IDCardData": {
        "properties": {
          "first_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Name"
          },
          "last_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Name"
          },
          "birth_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Birth Date"
          },
          "birth_place": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Birth Place"
          },
          "nationality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Nationality"
          },
          "document_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Document Number"
          },
          "expiry_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expiry Date"
          },
          "issue_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Issue Date"
          },
          "gender": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gender",
            "description": "M or F"
          }
        },
        "type": "object",
        "title": "IDCardData"
      },
      "InvoiceData": {
        "properties": {
          "vendor_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vendor Name"
          },
          "vendor_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vendor Address"
          },
          "vendor_tax_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vendor Tax Id",
            "description": "SIRET / tax ID"
          },
          "invoice_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Invoice Number"
          },
          "invoice_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Invoice Date"
          },
          "due_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Due Date"
          },
          "line_items": {
            "items": {
              "$ref": "#/components/schemas/LineItem"
            },
            "type": "array",
            "title": "Line Items"
          },
          "subtotal": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subtotal"
          },
          "vat_amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vat Amount"
          },
          "total_amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Amount"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency",
            "description": "ISO 4217 code (EUR, USD, ...)"
          },
          "payment_method": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Method"
          },
          "payment_reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Reference",
            "description": "IBAN or payment reference"
          }
        },
        "type": "object",
        "title": "InvoiceData"
      },
      "LineItem": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "quantity": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quantity"
          },
          "unit_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Unit Price"
          },
          "amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount"
          },
          "vat_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vat Rate"
          }
        },
        "type": "object",
        "title": "LineItem"
      },
      "ReceiptAnalysisItem": {
        "properties": {
          "index": {
            "type": "integer",
            "title": "Index"
          },
          "filename": {
            "type": "string",
            "title": "Filename"
          },
          "data": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ReceiptData"
              },
              {
                "type": "null"
              }
            ]
          },
          "confidence": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence"
          },
          "findings": {
            "items": {
              "$ref": "#/components/schemas/FindingOut"
            },
            "type": "array",
            "title": "Findings",
            "description": "Écarts de cohérence interne et de politique de dépenses. Une évaluation, jamais une autorisation : aucun reçu n'est rejeté."
          },
          "authenticity": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AuthenticityOut"
              },
              {
                "type": "null"
              }
            ],
            "description": "Signaux d'authenticité faibles et contournables — une aide au tri humain, jamais une preuve ni un verdict. `null` signifie que l'authenticité n'a pas pu être évaluée (fichier rejeté avant analyse, ou échec du fournisseur de signaux), jamais qu'aucun signal n'a été trouvé : l'absence de signal se lit sur un objet présent dont `signals` est vide."
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          }
        },
        "type": "object",
        "required": [
          "index",
          "filename"
        ],
        "title": "ReceiptAnalysisItem",
        "description": "Résultat de l'analyse d'un reçu du lot.\n\n`findings` et `authenticity` sont des **évaluations**, jamais des\nautorisations : ce service ne rejette aucun reçu et ne bloque rien — il\nrapporte des observations destinées à une relecture humaine ou à un\ncontrôle en aval."
      },
      "ReceiptAnalysisResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ReceiptAnalysisItem"
            },
            "type": "array",
            "title": "Items"
          },
          "duplicate_groups": {
            "items": {
              "$ref": "#/components/schemas/DuplicateGroupOut"
            },
            "type": "array",
            "title": "Duplicate Groups"
          },
          "analysed_at": {
            "type": "string",
            "format": "date-time",
            "title": "Analysed At"
          },
          "policy_is_default": {
            "type": "boolean",
            "title": "Policy Is Default"
          }
        },
        "type": "object",
        "required": [
          "items",
          "analysed_at",
          "policy_is_default"
        ],
        "title": "ReceiptAnalysisResponse",
        "description": "Réponse de l'analyse du lot.\n\nNe bloque rien, ne rejette aucun reçu pour cause de constat, et ne\nmodifie aucune politique de dépenses."
      },
      "ReceiptData": {
        "properties": {
          "vendor_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vendor Name"
          },
          "vendor_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vendor Address"
          },
          "receipt_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Receipt Date"
          },
          "receipt_time": {
            "anyOf": [
              {
                "type": "string",
                "format": "time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Receipt Time",
            "description": "Heure du ticket, si imprimée"
          },
          "line_items": {
            "items": {
              "$ref": "#/components/schemas/LineItem"
            },
            "type": "array",
            "title": "Line Items"
          },
          "subtotal": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subtotal"
          },
          "vat_amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vat Amount"
          },
          "vat_breakdown": {
            "items": {
              "$ref": "#/components/schemas/VatBreakdownEntry"
            },
            "type": "array",
            "title": "Vat Breakdown",
            "description": "Ventilation par taux ; vat_amount reste le total"
          },
          "total_amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Amount"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "payment_method": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Method"
          }
        },
        "type": "object",
        "title": "ReceiptData"
      },
      "ResumeData": {
        "properties": {
          "firstname": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Firstname"
          },
          "lastname": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lastname"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phone"
          },
          "location": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Location"
          },
          "linkedin": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linkedin"
          },
          "skills": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Skills"
          },
          "languages": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Languages"
          },
          "experiences": {
            "items": {
              "$ref": "#/components/schemas/Experience"
            },
            "type": "array",
            "title": "Experiences"
          },
          "diplomas": {
            "items": {
              "$ref": "#/components/schemas/Diploma"
            },
            "type": "array",
            "title": "Diplomas"
          },
          "certifications": {
            "items": {
              "$ref": "#/components/schemas/Certification"
            },
            "type": "array",
            "title": "Certifications"
          }
        },
        "type": "object",
        "title": "ResumeData"
      },
      "RibData": {
        "properties": {
          "holder_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Holder Name",
            "description": "Account holder as printed (titulaire)"
          },
          "iban": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Iban",
            "description": "IBAN without spaces"
          },
          "bic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bic"
          },
          "bank_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bank Name"
          },
          "bank_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bank Address",
            "description": "Domiciliation / agency address"
          },
          "agency_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agency Code",
            "description": "Code guichet (5 digits)"
          },
          "account_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Number",
            "description": "Numéro de compte (11 chars)"
          },
          "rib_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rib Key",
            "description": "Clé RIB (2 digits)"
          }
        },
        "type": "object",
        "title": "RibData"
      },
      "SchemaField": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "type": {
            "type": "string",
            "title": "Type"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          }
        },
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "title": "SchemaField",
        "description": "Description of a single field in a document schema."
      },
      "SchemaInfo": {
        "properties": {
          "document_type": {
            "type": "string",
            "title": "Document Type"
          },
          "fields": {
            "items": {
              "$ref": "#/components/schemas/SchemaField"
            },
            "type": "array",
            "title": "Fields"
          }
        },
        "type": "object",
        "required": [
          "document_type",
          "fields"
        ],
        "title": "SchemaInfo",
        "description": "Schema information for a document type."
      },
      "TextSource": {
        "type": "string",
        "enum": [
          "native_pdf",
          "ocr",
          "docx",
          "embedded_xml"
        ],
        "title": "TextSource"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "VatBreakdownEntry": {
        "properties": {
          "rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rate",
            "description": "Taux en pourcentage, ex. 20.0 ou 5.5"
          },
          "taxable_base": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Taxable Base",
            "description": "Base imposable pour ce taux"
          },
          "amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount",
            "description": "Montant de TVA pour ce taux"
          }
        },
        "type": "object",
        "title": "VatBreakdownEntry",
        "description": "Une ligne de ventilation de TVA : un taux, sa base imposable, son montant."
      }
    }
  }
}
