#!/bin/bash
# Inscription AM complète : jeux officiels alignés sur database/seed/03_seed_test_data.sql
#   node tests/scripts/register-am-dubois-test.mjs [BASE_URL]
#   node tests/scripts/register-am-mansouri-test.mjs [BASE_URL]
#
# Smoke curl (email + NIR jetables, hors seed — ne pas mélanger avec Marie / Fatima) :
# Usage: ./scripts/test-register-am.sh [BASE_URL]
# Exemple: ./scripts/test-register-am.sh http://localhost:3000/api/v1

BASE_URL="${1:-http://localhost:3000/api/v1}"
echo "POST $BASE_URL/auth/register/am (profil smoke, pas les AM du seed)"
echo "---"

curl -s -w "\n\nHTTP %{http_code}\n" -X POST "$BASE_URL/auth/register/am" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "smoke.am.curl@ptits-pas.fr",
    "prenom": "Smoke",
    "nom": "CURLTEST",
    "telephone": "0612345678",
    "adresse": "1 rue Smoke",
    "code_postal": "95870",
    "ville": "Bezons",
    "consentement_photo": false,
    "date_naissance": "1986-12-15",
    "nir": "186127500100279",
    "numero_agrement": "AGR-SMOKE-CURL-001",
    "capacite_accueil": 3,
    "places_disponibles": 2,
    "acceptation_cgu": true,
    "acceptation_privacy": true
  }'
