# 🧪 TEST GUIDE - Fonctionnalité Networking

## 🎯 **Comment Tester Toutes les Fonctionnalités**

### **1. 🌟 Favoriser un profil**

```bash
# 1. Créer une demande de networking
curl -X POST http://localhost:8000/api/v1/networking \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "receiver_id": 2,
    "subject": "Discussion Innovation Eau",
    "message": "Bonjour, j'\''aimerais échanger sur vos projets",
    "type": "chat"
  }'

# 2. Ajouter aux favoris (utiliser l'ID retourné)
curl -X POST http://localhost:8000/api/v1/networking/1/toggle-favorite \
  -H "Authorization: Bearer YOUR_TOKEN"

# 3. Voir mes favoris
curl -X GET http://localhost:8000/api/v1/networking/my/favorites \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### **2. 💬 Envoyer un message (chat)**

```bash
# 1. Créer une conversation de chat
curl -X POST http://localhost:8000/api/v1/networking \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "receiver_id": 3,
    "subject": "Chat - Traitement Eau",
    "message": "Salut! On peut discuter de ton projet?",
    "type": "chat"
  }'

# 2. Envoyer un message dans la conversation
curl -X POST http://localhost:8000/api/v1/chat/1/send \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "message": "Voici mon message de suivi!",
    "attachments": ["document.pdf", "image.jpg"]
  }'

# 3. Récupérer toutes mes conversations
curl -X GET http://localhost:8000/api/v1/chat/conversations \
  -H "Authorization: Bearer YOUR_TOKEN"

# 4. Voir les messages d'une conversation
curl -X GET http://localhost:8000/api/v1/chat/1/messages \
  -H "Authorization: Bearer YOUR_TOKEN"

# 5. Compter messages non lus
curl -X GET http://localhost:8000/api/v1/chat/unread-count \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### **3. 📅 Envoyer une demande de réunion**

```bash
# 1. Créer demande de réunion (Statut: Pending)
curl -X POST http://localhost:8000/api/v1/networking \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "receiver_id": 4,
    "subject": "Réunion Innovation Eau",
    "message": "Je souhaiterais programmer une réunion pour discuter de collaboration",
    "type": "meeting",
    "duration_meeting": 60,
    "location": "Salle de Conférence A",
    "date_of_meeting": "2025-08-15 14:00:00"
  }'

# 2. Récepteur accepte (Statut: Accepted → Programmé)
curl -X POST http://localhost:8000/api/v1/networking/2/accept \
  -H "Authorization: Bearer RECEIVER_TOKEN"

# 3. Voir mes demandes en attente (en tant que récepteur)
curl -X GET http://localhost:8000/api/v1/networking/my/pending \
  -H "Authorization: Bearer RECEIVER_TOKEN"

# 4. Marquer réunion comme terminée (Statut: Completed)
curl -X POST http://localhost:8000/api/v1/networking/2/complete \
  -H "Authorization: Bearer YOUR_TOKEN"

# 5. Voir réunions par date
curl -X GET "http://localhost:8000/api/v1/networking/meetings/by-date-range?start_date=2025-08-01&end_date=2025-08-31" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### **4. 🏢 Société (Exposant) - Chat et Meeting**

```bash
# 1. Créer networking avec contact préféré (entreprise)
curl -X POST http://localhost:8000/api/v1/networking \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "receiver_id": 5,
    "subject": "Partenariat Commercial",
    "message": "Notre entreprise cherche des partenaires innovants",
    "type": "meeting",
    "duration_meeting": 90,
    "location": "Bureau Commercial",
    "date_of_meeting": "2025-08-20 10:00:00",
    "preferred_contact": {
      "name": "Jean Dupont",
      "email": "jean.dupont@entreprise.com",
      "phone": "+33123456789",
      "position": "Directeur Commercial"
    }
  }'

# 2. Chat business avec contact préféré
curl -X POST http://localhost:8000/api/v1/networking \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "receiver_id": 6,
    "subject": "Discussion Business",
    "message": "Contactez notre responsable commercial",
    "type": "chat",
    "preferred_contact": {
      "name": "Marie Martin",
      "email": "marie.martin@entreprise.com",
      "phone": "+33987654321",
      "position": "Responsable Partenariats"
    }
  }'
```

### **5. 👥 Gestion des Participants (Bonus)**

```bash
# 1. Ajouter participants à une session
curl -X POST http://localhost:8000/api/v1/networking/1/participants \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "participants": [
      {
        "user_id": 7,
        "role": "speaker",
        "notes": "Expert en purification"
      },
      {
        "user_id": 8,
        "role": "moderator",
        "notes": "Modérateur expérimenté"
      }
    ]
  }'

# 2. Confirmer participation
curl -X POST http://localhost:8000/api/v1/networking/1/confirm-participation \
  -H "Authorization: Bearer PARTICIPANT_TOKEN"

# 3. Rejoindre session en temps réel
curl -X POST http://localhost:8000/api/v1/networking/1/join-session \
  -H "Authorization: Bearer PARTICIPANT_TOKEN"

# 4. Voir participants actifs
curl -X GET http://localhost:8000/api/v1/networking/1/participants/active \
  -H "Authorization: Bearer YOUR_TOKEN"
```

## 🔐 **Authentification**

```bash
# 1. Se connecter pour obtenir un token
curl -X POST http://localhost:8000/api/v1/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@gmail.com",
    "password": "password"
  }'

# Utiliser le token retourné dans Authorization: Bearer TOKEN
```

## 📊 **Tests de Status et Flow**

```bash
# Voir toutes mes demandes networking
curl -X GET http://localhost:8000/api/v1/networking/my/requests \
  -H "Authorization: Bearer YOUR_TOKEN"

# Voir demandes envoyées
curl -X GET "http://localhost:8000/api/v1/networking/my/requests?type=sent" \
  -H "Authorization: Bearer YOUR_TOKEN"

# Voir demandes reçues
curl -X GET "http://localhost:8000/api/v1/networking/my/requests?type=received" \
  -H "Authorization: Bearer YOUR_TOKEN"

# Rejeter une demande
curl -X POST http://localhost:8000/api/v1/networking/3/reject \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "rejection_reason": "Pas disponible à cette période"
  }'

# Annuler une demande
curl -X POST http://localhost:8000/api/v1/networking/3/cancel \
  -H "Authorization: Bearer YOUR_TOKEN"
```

## 🎯 **Workflow Complet de Test**

### **Scenario 1: Chat Simple**
1. Utilisateur A envoie demande de chat à B
2. B accepte → conversation active
3. Échange de messages
4. A ajoute B aux favoris

### **Scenario 2: Réunion Business**
1. Entreprise envoie demande de réunion avec contact préféré
2. Récepteur accepte → statut "Programmé"
3. Ajout de participants (speaker, moderator)
4. Session de réunion → marquer comme terminée

### **Scenario 3: Networking Multi-participants**
1. Organisateur crée session
2. Ajoute plusieurs participants avec rôles
3. Participants confirment/déclinent
4. Session active avec tracking temps réel

**🚀 Tous les endpoints sont fonctionnels et testables immédiatement!**
