> ## 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.

# Gérer son vivier

> Créer un vivier, ajouter candidats inscrits ou externes, inviter

# Gérer son vivier

Le **vivier** permet au recruteur de constituer un pool de candidats réutilisable sur plusieurs offres.

## Architecture

```mermaid theme={null}
flowchart LR
    R[Recruteur] --> V[Vivier]
    V --> I[Candidats inscrits]
    V --> E[Candidats externes]
    E --> INV[Invitation email]
    INV --> REG[Inscription plateforme]
    REG --> I
```

## 1. Créer un vivier

```http theme={null}
POST /v1/api/vivier HTTP/1.1
Authorization: Bearer <RECRUTEUR_TOKEN>
Content-Type: application/json

{
  "nom": "Senior Java — pipeline 2026",
  "description": "Profils backend Java pour futures ouvertures",
  "tags": ["Java", "Senior", "Backend"],
  "partageEntreprise": true
}
```

**Réponse** :

```json theme={null}
{ "id": 55, "nom": "Senior Java — pipeline 2026", "totalCandidats": 0 }
```

## 2. Ajouter un candidat inscrit

Via la recherche de profils publics.

```mermaid theme={null}
sequenceDiagram
    participant R as Recruteur
    participant API as Backend
    participant V as Vivier

    R->>API: GET /admin/candidates?q=java&niveauExperience=SENIOR
    API-->>R: Liste profils publics
    R->>API: POST /vivier/55/candidats {candidatId: 42}
    API->>V: INSERT vivier_candidats(vivierId, candidatId)
    API-->>R: 201
```

```http theme={null}
POST /v1/api/vivier/55/candidats HTTP/1.1
Content-Type: application/json

{ "candidatId": 42, "note": "Contacté lors du JobDay Douala" }
```

## 3. Ajouter un candidat externe (manuel)

```http theme={null}
POST /v1/api/vivier/55/candidats/external HTTP/1.1
Content-Type: application/json

{
  "firstName": "Alain",
  "lastName": "Mvondo",
  "email": "alain.mvondo@example.com",
  "phone": "+237690111222",
  "competences": ["Java", "Spring Boot"],
  "source": "LINKEDIN",
  "note": "Rencontré à la conf Yaoundé"
}
```

## 4. Import CSV bulk

Format attendu :

```csv theme={null}
firstName,lastName,email,phone,competences,source,note
Alain,Mvondo,alain@ex.com,+237690111222,"Java,Spring",LINKEDIN,Conf Yaoundé
Célestine,Kamga,c.kamga@ex.com,,"React,TS",RECOMMANDATION,Recommandée par Paul
```

```mermaid theme={null}
flowchart TD
    CSV[Upload CSV] --> PARSE[Parse + valider format]
    PARSE --> DEDUP{Email déjà présent\n dans ce vivier?}
    DEDUP -->|oui| SKIP[Skip + log ligne]
    DEDUP -->|non| INS[INSERT external_candidat + vivier_candidat]
    INS --> REPORT[Rapport: N insérés, M ignorés, K erreurs]
```

```http theme={null}
POST /v1/api/vivier/55/candidats/import-csv HTTP/1.1
Content-Type: multipart/form-data

file=@pipeline.csv
```

## 5. Inviter un externe à s'inscrire

```mermaid theme={null}
sequenceDiagram
    autonumber
    participant R as Recruteur
    participant API as Backend
    participant M as Mail
    participant C as Candidat externe

    R->>API: POST /vivier/candidats/702/invite
    API->>API: Générer token 24h
    API->>M: Template "Invitation THE HIVE"\n + lien prérempli
    M->>C: Email FR
    C->>API: GET /auth/invitation?token=...
    API->>API: Créer user + candidat + lier vivier
    API->>R: Notification "Alain s'est inscrit"
```

## 6. Suivre le statut

```mermaid theme={null}
stateDiagram-v2
    [*] --> NOUVEAU
    NOUVEAU --> CONTACTE
    CONTACTE --> INVITE
    INVITE --> INSCRIT
    INSCRIT --> [*]
    NOUVEAU --> HORS_CIBLE
    CONTACTE --> HORS_CIBLE
```

```http theme={null}
PATCH /v1/api/vivier/candidats/702 HTTP/1.1

{ "statut": "CONTACTE", "note": "Premier appel fait, revient vers nous" }
```

## 7. Lister les candidats d'un vivier

```http theme={null}
GET /v1/api/vivier/55?statut=CONTACTE&page=0&size=20 HTTP/1.1
```

## 8. Partager avec l'équipe

Le champ `partageEntreprise: true` rend le vivier visible à tous les `MEMBER` de l'entreprise. Le créateur reste le propriétaire administratif.

```mermaid theme={null}
flowchart LR
    OWN[OWNER crée] --> SHARE{partageEntreprise?}
    SHARE -->|true| VIS[Visible tous MEMBER]
    SHARE -->|false| PRV[Visible uniquement créateur]
```

## 9. Associer à une offre

Un candidat du vivier peut être **invité à postuler** à une offre :

```http theme={null}
POST /v1/api/vivier/candidats/701/invite-to-offre HTTP/1.1

{ "offreId": 123 }
```

Un email FR est envoyé au candidat inscrit avec un lien direct vers l'offre.

## Quotas par plan

| Plan       | Viviers max | Candidats par vivier | Imports CSV / mois |
| ---------- | :---------: | :------------------: | :----------------: |
| Gratuit    |      1      |          50          |          0         |
| Essentiel  |      5      |          500         |          5         |
| Pro        |      20     |         5000         |         50         |
| Entreprise |      ∞      |           ∞          |          ∞         |

## Cas d'usage

```mermaid theme={null}
flowchart TD
    U1[Journée recrutement] --> IMP[Import CSV CVs reçus]
    U2[Scouting LinkedIn] --> MAN[Ajout manuel]
    U3[Candidature non retenue] --> ADD[Ajout au vivier\n pour plus tard]
    U4[Pipeline Senior Java] --> MAIN[Vivier dédié]
```

<Info>
  Les candidats externes n'ont pas accès aux fonctionnalités candidat tant qu'ils ne se sont pas inscrits. Leurs données restent isolées dans `external_candidats`.
</Info>
