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

# Modèle Recruteur

> Schéma du compte recruteur et rattachement entreprise

# Recruteur

Un **recruteur** est un utilisateur rattaché à une `Entreprise`. Premier inscrit de l'entreprise = `OWNER`, suivants = `MEMBER`.

## Schéma

```mermaid theme={null}
classDiagram
    class Recruteur {
        +Long id
        +Long userId
        +Long entrepriseId
        +String firstName
        +String lastName
        +String phone
        +String poste
        +String role "OWNER|MEMBER"
        +String status "PENDING_EMAIL|PENDING_APPROVAL|ACTIVE|REJECTED|SUSPENDED|DEACTIVATED"
        +String rejectionReason
        +Instant createdAt
        +Instant approvedAt
    }

    class Entreprise {
        +Long id
        +String nom
        +String rccm
        +String secteur
        +Long villeId
        +String siteWeb
        +String logoKey
    }

    class User {
        +Long id
        +String email
        +String role
        +String status
    }

    User "1" --> "1" Recruteur
    Entreprise "1" --> "0..*" Recruteur
```

## Exemple JSON

```json theme={null}
{
  "id": 42,
  "userId": 210,
  "email": "marie@tech-corp.cm",
  "firstName": "Marie",
  "lastName": "Tchoumi",
  "phone": "+237677889900",
  "poste": "Responsable RH",
  "role": "OWNER",
  "status": "ACTIVE",
  "approvedAt": "2026-02-03T10:22:00Z",
  "entreprise": {
    "id": 18,
    "nom": "Tech Corp SARL",
    "rccm": "RC/DLA/2019/B/1234",
    "secteur": "SOFTWARE",
    "ville": { "id": 101, "nom": "Douala" },
    "siteWeb": "https://tech-corp.cm",
    "logoUrl": "https://cdn.wethehivers.com/public/entreprises/18/logo.png"
  }
}
```

## Cycle de vie

Voir [Cycle de vie d'un recruteur](/concepts/cycle-de-vie-recruteur) pour le détail complet.

```mermaid theme={null}
stateDiagram-v2
    [*] --> PENDING_EMAIL_VERIFICATION
    PENDING_EMAIL_VERIFICATION --> PENDING_ADMIN_APPROVAL
    PENDING_ADMIN_APPROVAL --> ACTIVE
    PENDING_ADMIN_APPROVAL --> REJECTED
    ACTIVE --> SUSPENDED
    ACTIVE --> DEACTIVATED
    SUSPENDED --> ACTIVE
    REJECTED --> PENDING_ADMIN_APPROVAL
```

## Permissions

```mermaid theme={null}
flowchart TD
    A[Action recruteur] --> ROLE{role?}
    ROLE -->|OWNER| OK1[Publier offre, éditer toutes offres,\n gérer entreprise, inviter membre]
    ROLE -->|MEMBER| OK2[Publier offre, éditer uniquement\n SES offres]
    ROLE -->|MEMBER| KO[Refus: éditer entreprise,\n inviter, supprimer]
```

| Action                | OWNER | MEMBER |
| --------------------- | :---: | :----: |
| Publier offre         |   ✓   |    ✓   |
| Éditer propre offre   |   ✓   |    ✓   |
| Éditer offre collègue |   ✓   |    ✗   |
| Modifier entreprise   |   ✓   |    ✗   |
| Inviter recruteur     |   ✓   |    ✗   |
| Révoquer membre       |   ✓   |    ✗   |

## Endpoints principaux

| Méthode | Path                                    | Rôle                     |
| ------- | --------------------------------------- | ------------------------ |
| `POST`  | `/v1/api/recruiters/register`           | Inscription              |
| `GET`   | `/v1/api/recruiters/me`                 | Profil + entreprise      |
| `PUT`   | `/v1/api/recruiters/me`                 | Mise à jour profil       |
| `GET`   | `/v1/api/recruteur/dashboard`           | KPIs offres/candidatures |
| `POST`  | `/v1/api/admin/recruiters/{id}/approve` | Admin : approuver        |
| `POST`  | `/v1/api/admin/recruiters/{id}/reject`  | Admin : rejeter          |

## Rattachement à une entreprise existante

```mermaid theme={null}
sequenceDiagram
    autonumber
    participant N as Nouveau recruteur
    participant API as Backend
    participant O as Owner existant
    participant DB as DB

    N->>API: POST /recruiters/register\n {rccm existant}
    API->>DB: SELECT entreprise WHERE rccm=?
    DB-->>API: entreprise trouvée
    API->>O: Email "Demande de rattachement"
    O->>API: POST /recruiters/invitations/{id}/accept
    API->>DB: INSERT recruteur(role=MEMBER)
    API->>N: Email "Rejoint entreprise"
```
