> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wethehivers.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflow de candidature

> Cycle de vie complet d'une candidature, de la soumission à la décision finale

# Workflow de candidature

Une candidature traverse plusieurs états avant d'aboutir à une embauche ou un refus. Ce guide détaille le cycle complet vu côté candidat et recruteur.

## Diagramme d'états

```mermaid theme={null}
stateDiagram-v2
    [*] --> NEW: Candidat postule
    NEW --> TO_MEET: Recruteur présélectionne
    NEW --> REJECTED: Recruteur refuse
    TO_MEET --> IN_PROGRESS: Entretien planifié
    IN_PROGRESS --> INTERVIEWED: Entretien passé
    INTERVIEWED --> HIRED: Offre acceptée
    INTERVIEWED --> REJECTED: Candidat non retenu
    HIRED --> [*]
    REJECTED --> [*]
```

## 1. Soumission (Candidat)

Le candidat postule à une offre publiée :

```bash theme={null}
curl -X POST https://api.wethehivers.com/v1/api/candidatures \
  -H "Authorization: Bearer <token-candidat>" \
  -H "Content-Type: application/json" \
  -d '{
    "offreId": 42,
    "lettreMotivation": "Bonjour, je souhaite rejoindre votre équipe..."
  }'
```

Prérequis côté candidat :

* Profil complet (nom, email, téléphone).
* CV uploadé (au moins un).
* Photo de profil (optionnel mais recommandé).

<Warning>
  Un candidat ne peut postuler qu'une seule fois à une offre donnée. Un second appel renvoie `409 Conflict`.
</Warning>

## 2. Présélection (Recruteur)

Le recruteur consulte ses candidatures reçues :

```bash theme={null}
curl https://api.wethehivers.com/v1/api/recruteur/candidatures?status=NEW \
  -H "Authorization: Bearer <token-recruteur>"
```

Puis met à jour le statut :

```bash theme={null}
curl -X PATCH https://api.wethehivers.com/v1/api/candidatures/123/status \
  -H "Authorization: Bearer <token-recruteur>" \
  -H "Content-Type: application/json" \
  -d '{ "status": "TO_MEET" }'
```

## 3. Entretien planifié

Le recruteur planifie un entretien. Le candidat reçoit un email et une notification in-app.

```bash theme={null}
curl -X POST https://api.wethehivers.com/v1/api/candidatures/123/interview \
  -H "Authorization: Bearer <token-recruteur>" \
  -H "Content-Type: application/json" \
  -d '{
    "date": "2026-05-05T14:00:00Z",
    "lieu": "Siège TechCorp, Douala",
    "type": "PRESENTIEL"
  }'
```

Le statut passe automatiquement à `IN_PROGRESS`.

## 4. Décision finale

Après l'entretien, le recruteur conclut :

```bash theme={null}
curl -X PATCH https://api.wethehivers.com/v1/api/candidatures/123/status \
  -H "Authorization: Bearer <token-recruteur>" \
  -H "Content-Type: application/json" \
  -d '{ "status": "HIRED" }'
```

Le candidat est notifié du résultat. Une candidature `HIRED` ou `REJECTED` est définitive.

## Retrait par le candidat

Le candidat peut retirer sa candidature tant qu'elle n'est pas `HIRED` ou `REJECTED` :

```bash theme={null}
curl -X POST https://api.wethehivers.com/v1/api/candidatures/123/withdraw \
  -H "Authorization: Bearer <token-candidat>"
```
