{
  "openapi": "3.1.0",
  "info": {
    "title": "Djinn Candidate Analyzer",
    "description": "Analyse et classement de candidatures par pertinence pour postes",
    "version": "0.1.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/analyze": {
      "post": {
        "summary": "Analyze",
        "description": "Analyze a single candidate against a job description.",
        "operationId": "analyze_v1_analyze_post",
        "parameters": [
          {
            "name": "X-Internal-Service",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Internal-Service"
            }
          },
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Tenant-Id"
            }
          },
          {
            "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/AnalyzeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CandidateAnalysis"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/analyze/batch": {
      "post": {
        "summary": "Analyze Batch",
        "description": "Analyze multiple candidates and return sorted by score.",
        "operationId": "analyze_batch_v1_analyze_batch_post",
        "parameters": [
          {
            "name": "X-Internal-Service",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Internal-Service"
            }
          },
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Tenant-Id"
            }
          },
          {
            "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/AnalyzeBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyzeBatchResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/analyze/competency-file": {
      "post": {
        "summary": "Analyze Competency File",
        "description": "Analyze a competency file (raw text) against a job description.",
        "operationId": "analyze_competency_file_v1_analyze_competency_file_post",
        "parameters": [
          {
            "name": "X-Internal-Service",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Internal-Service"
            }
          },
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Tenant-Id"
            }
          },
          {
            "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/CompetencyFileRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CandidateAnalysis"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AnalyzeBatchRequest": {
        "properties": {
          "job": {
            "$ref": "#/components/schemas/JobDescription"
          },
          "candidates": {
            "items": {
              "$ref": "#/components/schemas/CandidateProfile"
            },
            "type": "array",
            "maxItems": 500,
            "minItems": 1,
            "title": "Candidates"
          },
          "weights": {
            "$ref": "#/components/schemas/ScoringWeights"
          }
        },
        "type": "object",
        "required": [
          "job",
          "candidates"
        ],
        "title": "AnalyzeBatchRequest",
        "description": "Requête d'analyse de plusieurs candidats."
      },
      "AnalyzeBatchResponse": {
        "properties": {
          "job_title": {
            "type": "string",
            "title": "Job Title"
          },
          "candidates": {
            "items": {
              "$ref": "#/components/schemas/CandidateAnalysis"
            },
            "type": "array",
            "title": "Candidates"
          },
          "total_analyzed": {
            "type": "integer",
            "title": "Total Analyzed"
          }
        },
        "type": "object",
        "required": [
          "job_title",
          "candidates",
          "total_analyzed"
        ],
        "title": "AnalyzeBatchResponse",
        "description": "Réponse d'analyse batch (triée par score décroissant)."
      },
      "AnalyzeRequest": {
        "properties": {
          "job": {
            "$ref": "#/components/schemas/JobDescription"
          },
          "candidate": {
            "$ref": "#/components/schemas/CandidateProfile"
          },
          "weights": {
            "$ref": "#/components/schemas/ScoringWeights"
          }
        },
        "type": "object",
        "required": [
          "job",
          "candidate"
        ],
        "title": "AnalyzeRequest",
        "description": "Requête d'analyse d'un candidat."
      },
      "CandidateAnalysis": {
        "properties": {
          "candidate_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Candidate Id"
          },
          "candidate_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Candidate Name"
          },
          "overall_score": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Overall Score"
          },
          "dimension_scores": {
            "items": {
              "$ref": "#/components/schemas/DimensionScore"
            },
            "type": "array",
            "title": "Dimension Scores"
          },
          "strengths": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Strengths"
          },
          "gaps": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Gaps"
          },
          "summary": {
            "type": "string",
            "title": "Summary",
            "default": ""
          },
          "fit_level": {
            "type": "string",
            "title": "Fit Level",
            "description": "excellent | good | moderate | weak",
            "default": "moderate"
          }
        },
        "type": "object",
        "required": [
          "overall_score"
        ],
        "title": "CandidateAnalysis",
        "description": "Résultat d'analyse pour un candidat."
      },
      "CandidateProfile": {
        "properties": {
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "firstname": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Firstname"
          },
          "lastname": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lastname"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "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": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Certifications"
          },
          "location": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Location"
          },
          "raw_text": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500000
              },
              {
                "type": "null"
              }
            ],
            "title": "Raw Text"
          }
        },
        "type": "object",
        "title": "CandidateProfile",
        "description": "Profil candidat (accepte la sortie de doc-extract ResumeData)."
      },
      "CompetencyFileRequest": {
        "properties": {
          "job": {
            "$ref": "#/components/schemas/JobDescription"
          },
          "competency_text": {
            "type": "string",
            "maxLength": 500000,
            "minLength": 1,
            "title": "Competency Text"
          },
          "weights": {
            "$ref": "#/components/schemas/ScoringWeights"
          }
        },
        "type": "object",
        "required": [
          "job",
          "competency_text"
        ],
        "title": "CompetencyFileRequest",
        "description": "Requête d'analyse d'un dossier de compétences."
      },
      "DimensionScore": {
        "properties": {
          "dimension": {
            "type": "string",
            "title": "Dimension"
          },
          "score": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Score"
          },
          "details": {
            "type": "string",
            "title": "Details",
            "default": ""
          }
        },
        "type": "object",
        "required": [
          "dimension",
          "score"
        ],
        "title": "DimensionScore",
        "description": "Score détaillé pour une dimension."
      },
      "Diploma": {
        "properties": {
          "school": {
            "type": "string",
            "title": "School",
            "default": ""
          },
          "degree": {
            "type": "string",
            "title": "Degree",
            "default": ""
          },
          "field_of_study": {
            "type": "string",
            "title": "Field Of Study",
            "default": ""
          },
          "start_date": {
            "type": "string",
            "title": "Start Date",
            "default": ""
          },
          "end_date": {
            "type": "string",
            "title": "End Date",
            "default": ""
          }
        },
        "type": "object",
        "title": "Diploma",
        "description": "Diplome."
      },
      "Experience": {
        "properties": {
          "company": {
            "type": "string",
            "title": "Company",
            "default": ""
          },
          "title": {
            "type": "string",
            "title": "Title",
            "default": ""
          },
          "location": {
            "type": "string",
            "title": "Location",
            "default": ""
          },
          "start_date": {
            "type": "string",
            "title": "Start Date",
            "default": ""
          },
          "end_date": {
            "type": "string",
            "title": "End Date",
            "default": ""
          },
          "description": {
            "type": "string",
            "title": "Description",
            "default": ""
          }
        },
        "type": "object",
        "title": "Experience",
        "description": "Experience professionnelle."
      },
      "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.1.0"
          }
        },
        "type": "object",
        "title": "HealthResponse",
        "description": "Response for health check."
      },
      "JobDescription": {
        "properties": {
          "title": {
            "type": "string",
            "title": "Title"
          },
          "description": {
            "type": "string",
            "title": "Description",
            "default": ""
          },
          "required_skills": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Required Skills"
          },
          "preferred_skills": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Preferred Skills"
          },
          "min_experience_years": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min Experience Years"
          },
          "required_languages": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Required Languages"
          },
          "required_education": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Required Education"
          },
          "location": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Location"
          },
          "remote_policy": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Remote Policy",
            "description": "onsite | hybrid | remote"
          }
        },
        "type": "object",
        "required": [
          "title"
        ],
        "title": "JobDescription",
        "description": "Description du poste à pourvoir."
      },
      "ScoringWeights": {
        "properties": {
          "skills": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Skills",
            "default": 0.3
          },
          "experience": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Experience",
            "default": 0.25
          },
          "education": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Education",
            "default": 0.15
          },
          "languages": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Languages",
            "default": 0.15
          },
          "location": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Location",
            "default": 0.15
          }
        },
        "type": "object",
        "title": "ScoringWeights",
        "description": "Poids configurables pour les 5 dimensions de scoring."
      },
      "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"
      }
    }
  }
}
