/**
 * Programme Débutant — 4 semaines, 3 séances/semaine
 * Source: TabataKine_Guide_Complet.md
 * Tier: GRATUIT
 *
 * Règles:
 * - Zéro impact les 2 premières semaines
 * - La technique avant l'intensité
 * - Semaine 4 = décharge (volume réduit 40%)
 */

import type { TabataProgram, TabataSession, TabataWeek, TabataBlock, TabataExercise } from '../../types/program'

// ─── Exercise helpers ──────────────────────────────────────────

const ex = (
  name: string, nameEn: string,
  conseil: string, conseilEn: string,
  opts?: { modification?: string; modificationEn?: string; progression?: string; progressionEn?: string }
): TabataExercise => ({
  name, nameEn, conseil, conseilEn, ...opts,
})

const block = (
  id: string,
  odd: TabataExercise,
  even: TabataExercise,
  rounds = 8,
  workTime = 20,
  restTime = 10,
): TabataBlock => ({
  id, oddExercise: odd, evenExercise: even, rounds, workTime, restTime,
})

// ─── Exercises Library ─────────────────────────────────────────

const SQUAT_CLASSIQUE = ex(
  'Squat classique', 'Classic Squat',
  'Si les talons se soulèvent : écarter davantage les pieds ou placer un support sous les talons. Genoux dans l\'axe des pieds, jamais vers l\'intérieur.',
  'If heels lift: widen your stance or place a support under heels. Keep knees aligned with feet, never cave inward.',
)

const PONT_FESSIER = ex(
  'Pont fessier', 'Glute Bridge',
  'Ne pas creuser le bas du dos en position haute. Le bassin monte grâce aux fessiers, pas grâce aux lombaires.',
  'Don\'t arch your lower back at the top. Drive through your glutes, not your lower back.',
)

const POMPE_GENOUX = ex(
  'Pompes genoux', 'Knee Push-ups',
  'Si douleur aux poignets : faire sur les poings fermés ou les avant-bras. Vérifier l\'alignement poignet / coude / épaule.',
  'If wrist pain: do them on closed fists or forearms. Check wrist/elbow/shoulder alignment.',
)

const PLANCHE_AVANT_BRAS = ex(
  'Planche avant-bras', 'Forearm Plank',
  'Respirer normalement. La planche doit être une contraction active — réduire la durée si tremblements excessifs.',
  'Breathe normally. Plank should be an active contraction — reduce duration if excessive shaking.',
)

const STEP_TOUCH = ex(
  'Step touch latéral', 'Lateral Step Touch',
  'Garder le regard droit. Les bras actifs contribuent à 20% de l\'effort cardiovasculaire.',
  'Keep eyes forward. Active arms contribute 20% of cardiovascular effort.',
)

const SUPERMAN = ex(
  'Superman', 'Superman',
  'Ne pas forcer sur le cou — il reste dans l\'axe. Exercice roi pour les lombaires et les paravertébraux.',
  'Don\'t strain your neck — keep it aligned. Top exercise for lower back and paraspinal muscles.',
)

const FENTE_AVANT = ex(
  'Fente avant alternée', 'Alternating Forward Lunge',
  'Le genou avant ne dépasse pas les orteils. Si douleur rotulienne : réduire l\'amplitude.',
  'Front knee should not pass toes. If kneecap pain: reduce range of motion.',
)

const DEAD_BUG = ex(
  'Dead bug', 'Dead Bug',
  'Gainage profond transverse — excellent pour les lombaires. La version un seul membre reste disponible si besoin.',
  'Deep transverse core engagement — excellent for lower back. Single-limb version available if needed.',
)

const BIRD_DOG = ex(
  'Bird dog', 'Bird Dog',
  'Placer une bouteille sur le dos pour vérifier que le bassin reste horizontal.',
  'Place a bottle on your back to check that your pelvis stays horizontal.',
)

const SQUAT_JUMP_LOW = ex(
  'Squat jump low', 'Low Squat Jump',
  'Réception silencieuse sur avant-pied. Si bruit à l\'atterrissage : réduire la hauteur.',
  'Silent landing on forefoot. If you hear noise on landing: reduce height.',
)

const STEP_UP = ex(
  'Step-up sur marche', 'Step-up',
  'Genou de la jambe de montée au-dessus du pied de la marche.',
  'Knee of stepping leg should be above the step foot.',
)

const MOUNTAIN_CLIMBER_LENt = ex(
  'Mountain climber lent', 'Slow Mountain Climber',
  'Gainage parfait pendant tout le mouvement. Ne pas laisser les hanches monter.',
  'Perfect core engagement throughout. Don\'t let hips rise.',
)

const PONT_FESSIER_UNILAT = ex(
  'Pont fessier unilatéral', 'Single-leg Glute Bridge',
  'Le bassin ne doit pas s\'incliner du côté de la jambe levée — signe de faiblesse du moyen fessier.',
  'Pelvis should not tilt toward the raised leg — indicates gluteus medius weakness.',
)

const FENTE_AVANT_MAÎTRISÉE = ex(
  'Fente avant maîtrisée', 'Controlled Forward Lunge',
  '¼ de descente supplémentaire par rapport à la semaine 1. Contrôle total du mouvement.',
  'Quarter descent deeper than week 1. Total control of the movement.',
)

const SQUAT_CONSOLIDATION = ex(
  'Squat classique (consolidation)', 'Classic Squat (consolidation)',
  'Augmenter la profondeur, viser cuisses parallèles au sol, tempo 2-1-2.',
  'Increase depth, aim for thighs parallel to floor, tempo 2-1-2.',
)

const PONT_FESSIER_CONSOL = ex(
  'Pont fessier (consolidation)', 'Glute Bridge (consolidation)',
  'Ajouter 1 sec de maintien en haut, soulever les orteils pour intensifier.',
  'Add 1 sec hold at the top, lift toes to intensify.',
)

const POMPE_GENOUX_CONSOL = ex(
  'Pompes genoux (consolidation)', 'Knee Push-ups (consolidation)',
  'Essayer 2–3 pompes complètes sur orteils si possible.',
  'Try 2–3 full push-ups on toes if possible.',
)

const PLANCHE_CONSOL = ex(
  'Planche avant-bras (consolidation)', 'Forearm Plank (consolidation)',
  'Tenter la planche sur orteils 10 sec puis repasser sur genoux si besoin.',
  'Try plank on toes for 10 sec then return to knees if needed.',
)

const SUPERMAN_DYNAMIQUE = ex(
  'Superman dynamique', 'Dynamic Superman',
  'Version dynamique : lever et descendre en rythme avec la respiration.',
  'Dynamic version: raise and lower in rhythm with breathing.',
)

const STEP_TOUCH_CONSOL = ex(
  'Step touch (consolidation)', 'Step Touch (consolidation)',
  'Augmenter la vitesse, bras au-dessus des épaules.',
  'Increase speed, arms above shoulders.',
)

const SUPERMAN_CONSOL = ex(
  'Superman (consolidation)', 'Superman (consolidation)',
  'Maintenir la position haute 3 secondes au lieu de 2.',
  'Hold the top position for 3 seconds instead of 2.',
)

const FENTE_ROTATION = ex(
  'Fente avant + rotation de buste', 'Forward Lunge + Torso Rotation',
  'En fente basse, rotation du tronc vers le genou avant.',
  'In low lunge, rotate torso toward front knee.',
)

const DEAD_BUG_LENt = ex(
  'Dead bug lent', 'Slow Dead Bug',
  '5 secondes par membre, qualité absolue.',
  '5 seconds per limb, absolute quality.',
)

// ─── Week 1: Découverte du rythme (1 bloc/séance) ────────────

const week1: TabataWeek = {
  weekNumber: 1,
  title: 'Découverte du rythme',
  titleEn: 'Finding Your Rhythm',
  description: 'Un bloc tabata par séance (4 min) + échauffement + retour au calme. Durée totale : ~20 minutes.',
  descriptionEn: 'One tabata block per session (4 min) + warmup + cooldown. Total duration: ~20 min.',
  focus: 'Apprentissage du protocole 20/10, technique de base',
  focusEn: 'Learning the 20/10 protocol, basic technique',
  isDeload: false,
  sessions: [
    // 1A — Membres inférieurs
    {
      id: 'deb-w1-s1',
      week: 1, order: 1,
      title: 'Membres inférieurs',
      titleEn: 'Lower Body',
      description: 'Squat classique et pont fessier pour construire les bases des jambes.',
      descriptionEn: 'Classic squat and glute bridge to build leg foundations.',
      focus: ['Quadriceps', 'Fessiers', 'Mollets'],
      focusEn: ['Quadriceps', 'Glutes', 'Calves'],
      warmup: {
        movements: [
          { name: 'Marche sur place genoux hauts', nameEn: 'High-knee March in Place', duration: 60 },
          { name: 'Cercles de chevilles', nameEn: 'Ankle Circles', duration: 60 },
          { name: 'Flexions de genoux lentes', nameEn: 'Slow Knee Bends', duration: 60 },
          { name: 'Fentes statiques alternées', nameEn: 'Alternating Static Lunges', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w1-s1-b1', SQUAT_CLASSIQUE, PONT_FESSIER),
      ],
      cooldown: {
        movements: [
          { name: 'Étirement quadriceps debout (chaque jambe)', nameEn: 'Standing Quad Stretch (each leg)', duration: 45 },
          { name: 'Étirement ischio-jambiers assis (chaque jambe)', nameEn: 'Seated Hamstring Stretch (each leg)', duration: 45 },
          { name: 'Respiration diaphragmatique', nameEn: 'Diaphragmatic Breathing', duration: 30 },
        ],
        totalDuration: 120,
      },
      equipment: ['Tapis (optionnel)'],
      totalRounds: 8,
      totalDuration: 20,
      calories: 45,
    },
    // 1B — Membres supérieurs & gainage
    {
      id: 'deb-w1-s2',
      week: 1, order: 2,
      title: 'Membres supérieurs & gainage',
      titleEn: 'Upper Body & Core',
      description: 'Pompes sur genoux et planche avant-bras pour renforcer le haut du corps.',
      descriptionEn: 'Knee push-ups and forearm plank to strengthen upper body.',
      focus: ['Pectoraux', 'Triceps', 'Abdominaux profonds'],
      focusEn: ['Chest', 'Triceps', 'Deep Core'],
      warmup: {
        movements: [
          { name: 'Rotations d\'épaules avant et arrière', nameEn: 'Shoulder Circles Forward & Back', duration: 60 },
          { name: 'Ouvertures de poitrine', nameEn: 'Chest Openers', duration: 60 },
          { name: 'Cercles de poignets', nameEn: 'Wrist Circles', duration: 60 },
          { name: 'Cat-cow (mobilité lombaire)', nameEn: 'Cat-Cow (Spinal Mobility)', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w1-s2-b1', POMPE_GENOUX, PLANCHE_AVANT_BRAS),
      ],
      cooldown: {
        movements: [
          { name: 'Étirement pectoraux contre un mur (chaque côté)', nameEn: 'Wall Chest Stretch (each side)', duration: 45 },
          { name: 'Étirement triceps derrière la tête', nameEn: 'Overhead Triceps Stretch', duration: 30 },
          { name: 'Étirement cervical latéral doux', nameEn: 'Gentle Lateral Neck Stretch', duration: 30 },
        ],
        totalDuration: 120,
      },
      equipment: ['Tapis (optionnel)'],
      totalRounds: 8,
      totalDuration: 20,
      calories: 40,
    },
    // 1C — Corps entier
    {
      id: 'deb-w1-s3',
      week: 1, order: 3,
      title: 'Corps entier',
      titleEn: 'Full Body',
      description: 'Step touch latéral et superman pour une séance complète sans impact.',
      descriptionEn: 'Lateral step touch and superman for a complete no-impact session.',
      focus: ['Cardio léger', 'Dos', 'Épaules'],
      focusEn: ['Light Cardio', 'Back', 'Shoulders'],
      warmup: {
        movements: [
          { name: 'Jumping jacks lents sans sauter', nameEn: 'Slow Jumping Jacks (no jump)', duration: 60 },
          { name: 'Rotations de hanches debout', nameEn: 'Standing Hip Circles', duration: 60 },
          { name: 'Marche avec bras croisés', nameEn: 'Walking with Crossed Arms', duration: 60 },
          { name: 'Squats ¼ de descente', nameEn: 'Quarter Squats', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w1-s3-b1', STEP_TOUCH, SUPERMAN),
      ],
      cooldown: {
        movements: [
          { name: 'Posture de l\'enfant (balasana)', nameEn: 'Child\'s Pose (Balasana)', duration: 60 },
          { name: 'Étirement des hanches en pigeon (chaque côté)', nameEn: 'Pigeon Hip Stretch (each side)', duration: 45 },
        ],
        totalDuration: 105,
      },
      equipment: ['Tapis (optionnel)'],
      totalRounds: 8,
      totalDuration: 20,
      calories: 42,
    },
  ],
}

// ─── Week 2: Consolidation (2 blocs/séance) ──────────────────

const week2: TabataWeek = {
  weekNumber: 2,
  title: 'Consolidation',
  titleEn: 'Building Strength',
  description: '2 blocs tabata + 1 min récupération entre les blocs. Durée totale : ~25 minutes.',
  descriptionEn: '2 tabata blocks + 1 min recovery between blocks. Total duration: ~25 min.',
  focus: 'Consolidation des mouvements, introduction de nouveaux exercices',
  focusEn: 'Consolidating movements, introducing new exercises',
  isDeload: false,
  sessions: [
    // 2A — Membres inférieurs renforcés
    {
      id: 'deb-w2-s1',
      week: 2, order: 1,
      title: 'Membres inférieurs renforcés',
      titleEn: 'Strengthened Lower Body',
      description: 'Consolidation squat + pont fessier, puis fente avant + dead bug.',
      descriptionEn: 'Consolidation squat + glute bridge, then forward lunge + dead bug.',
      focus: ['Quadriceps', 'Fessiers', 'Transverse'],
      focusEn: ['Quadriceps', 'Glutes', 'Transverse Abdominis'],
      warmup: {
        movements: [
          { name: 'Marche sur place avec genoux hauts', nameEn: 'High-knee March', duration: 60 },
          { name: 'Squats lents d\'activation', nameEn: 'Slow Activation Squats', duration: 60 },
          { name: 'Cercles de hanches', nameEn: 'Hip Circles', duration: 60 },
          { name: 'Fentes statiques légères', nameEn: 'Light Static Lunges', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w2-s1-b1', SQUAT_CONSOLIDATION, PONT_FESSIER_CONSOL),
        block('deb-w2-s1-b2', FENTE_AVANT, DEAD_BUG),
      ],
      cooldown: {
        movements: [
          { name: 'Étirement du psoas en fente basse (chaque côté)', nameEn: 'Low Lunge Psoas Stretch (each side)', duration: 60 },
          { name: 'Étirement des ischio-jambiers allongé', nameEn: 'Lying Hamstring Stretch', duration: 45 },
          { name: 'Respiration guidée', nameEn: 'Guided Breathing', duration: 30 },
        ],
        totalDuration: 135,
      },
      equipment: ['Tapis (optionnel)'],
      totalRounds: 16,
      totalDuration: 25,
      calories: 75,
    },
    // 2B — Haut du corps renforcé
    {
      id: 'deb-w2-s2',
      week: 2, order: 2,
      title: 'Haut du corps renforcé',
      titleEn: 'Strengthened Upper Body',
      description: 'Consolidation pompes + planche, puis bird dog + superman dynamique.',
      descriptionEn: 'Consolidation push-ups + plank, then bird dog + dynamic superman.',
      focus: ['Pectoraux', 'Épaules', 'Lombaires'],
      focusEn: ['Chest', 'Shoulders', 'Lower Back'],
      warmup: {
        movements: [
          { name: 'Rotations d\'épaules complètes', nameEn: 'Full Shoulder Rotations', duration: 60 },
          { name: 'Pompes lentes d\'activation', nameEn: 'Slow Activation Push-ups', duration: 60 },
          { name: 'Planche dynamique haute ↔ basse', nameEn: 'Dynamic Plank High ↔ Low', duration: 60 },
          { name: 'Cat-cow', nameEn: 'Cat-Cow', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w2-s2-b1', POMPE_GENOUX_CONSOL, PLANCHE_CONSOL),
        block('deb-w2-s2-b2', BIRD_DOG, SUPERMAN_DYNAMIQUE),
      ],
      cooldown: {
        movements: [
          { name: 'Étirement pectoraux en porte', nameEn: 'Doorway Chest Stretch', duration: 45 },
          { name: 'Étirement grand dorsal', nameEn: 'Lat Stretch', duration: 45 },
          { name: 'Respiration guidée', nameEn: 'Guided Breathing', duration: 30 },
        ],
        totalDuration: 120,
      },
      equipment: ['Tapis (optionnel)'],
      totalRounds: 16,
      totalDuration: 25,
      calories: 70,
    },
    // 2C — Corps entier mixte
    {
      id: 'deb-w2-s3',
      week: 2, order: 3,
      title: 'Corps entier mixte',
      titleEn: 'Mixed Full Body',
      description: 'Consolidation step touch + superman, puis fente rotation + dead bug lent.',
      descriptionEn: 'Consolidation step touch + superman, then lunge rotation + slow dead bug.',
      focus: ['Cardio', 'Gainage', 'Mobilité thoracique'],
      focusEn: ['Cardio', 'Core', 'Thoracic Mobility'],
      warmup: {
        movements: [
          { name: 'Jumping jacks lents', nameEn: 'Slow Jumping Jacks', duration: 60 },
          { name: 'Rotations de hanches', nameEn: 'Hip Circles', duration: 60 },
          { name: 'Squats légers', nameEn: 'Light Squats', duration: 60 },
          { name: 'Mobilisation cervicale', nameEn: 'Neck Mobilization', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w2-s3-b1', STEP_TOUCH_CONSOL, SUPERMAN_CONSOL),
        block('deb-w2-s3-b2', FENTE_ROTATION, DEAD_BUG_LENt),
      ],
      cooldown: {
        movements: [
          { name: 'Posture de l\'enfant', nameEn: 'Child\'s Pose', duration: 60 },
          { name: 'Torsion vertébrale au sol (chaque côté)', nameEn: 'Supine Spinal Twist (each side)', duration: 45 },
          { name: 'Respiration 4-7-8', nameEn: '4-7-8 Breathing', duration: 30 },
        ],
        totalDuration: 135,
      },
      equipment: ['Tapis (optionnel)'],
      totalRounds: 16,
      totalDuration: 25,
      calories: 72,
    },
  ],
}

// ─── Week 3: Montée en intensité (3 blocs/séance) ────────────

const week3: TabataWeek = {
  weekNumber: 3,
  title: 'Montée en intensité',
  titleEn: 'Building Intensity',
  description: '3 blocs tabata + 1 min récupération entre chaque. Durée totale : ~30 minutes.',
  descriptionEn: '3 tabata blocks + 1 min recovery between each. Total duration: ~30 min.',
  focus: 'Introduction d\'impacts très légers, augmentation du volume',
  focusEn: 'Introducing very light impact, increasing volume',
  isDeload: false,
  sessions: [
    // 3A — Membres inférieurs
    {
      id: 'deb-w3-s1',
      week: 3, order: 1,
      title: 'Membres inférieurs explosifs',
      titleEn: 'Explosive Lower Body',
      description: 'Squat classique + pont unilatéral, squat jump low + fente maîtrisée, step-up + mountain climber.',
      descriptionEn: 'Classic squat + single-leg bridge, low squat jump + controlled lunge, step-up + mountain climber.',
      focus: ['Puissance', 'Équilibre', 'Proprioception'],
      focusEn: ['Power', 'Balance', 'Proprioception'],
      warmup: {
        movements: [
          { name: 'Marche rapide avec bras actifs', nameEn: 'Brisk Walk with Active Arms', duration: 60 },
          { name: 'Squats lents x10', nameEn: 'Slow Squats x10', duration: 60 },
          { name: 'Montées de genoux', nameEn: 'High Knees', duration: 60 },
          { name: 'Hip circles', nameEn: 'Hip Circles', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w3-s1-b1', SQUAT_CONSOLIDATION, PONT_FESSIER_UNILAT),
        block('deb-w3-s1-b2', SQUAT_JUMP_LOW, FENTE_AVANT_MAÎTRISÉE),
        block('deb-w3-s1-b3', STEP_UP, MOUNTAIN_CLIMBER_LENt),
      ],
      cooldown: {
        movements: [
          { name: 'Étirement psoas en fente basse', nameEn: 'Low Lunge Psoas Stretch', duration: 60 },
          { name: 'Étirement mollets contre un mur', nameEn: 'Wall Calf Stretch', duration: 45 },
          { name: 'Automassage quadriceps', nameEn: 'Self-massage Quadriceps', duration: 45 },
          { name: 'Respiration guidée', nameEn: 'Guided Breathing', duration: 30 },
        ],
        totalDuration: 180,
      },
      equipment: ['Marche ou step bas', 'Tapis (optionnel)'],
      totalRounds: 24,
      totalDuration: 30,
      calories: 120,
    },
    // 3B — Haut du corps
    {
      id: 'deb-w3-s2',
      week: 3, order: 2,
      title: 'Haut du corps dynamique',
      titleEn: 'Dynamic Upper Body',
      description: 'Pompes + planche consolidation, pompes rotation + planche tap épaule, superman dynamique.',
      descriptionEn: 'Push-ups + plank consolidation, rotation push-ups + shoulder tap plank, dynamic superman.',
      focus: ['Pectoraux', 'Épaules', 'Stabilité scapulaire'],
      focusEn: ['Chest', 'Shoulders', 'Scapular Stability'],
      warmup: {
        movements: [
          { name: 'Rotations complètes d\'épaules', nameEn: 'Full Shoulder Rotations', duration: 60 },
          { name: 'Pompes lentes x8', nameEn: 'Slow Push-ups x8', duration: 60 },
          { name: 'Planche dynamique haute ↔ basse', nameEn: 'Dynamic Plank High ↔ Low', duration: 60 },
          { name: 'Dead bug lent', nameEn: 'Slow Dead Bug', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w3-s2-b1', POMPE_GENOUX_CONSOL, PLANCHE_CONSOL),
        block('deb-w3-s2-b2', BIRD_DOG, SUPERMAN_DYNAMIQUE),
        block('deb-w3-s2-b3',
          ex('Pompe avec rotation', 'Push-up with Rotation', 'Ouvrir complètement la hanche à la rotation.', 'Fully open hip on rotation.'),
          ex('Planche tap épaule', 'Plank Shoulder Tap', 'Résister à la rotation du bassin. Pieds plus écartés pour stabiliser.', 'Resist pelvic rotation. Wider feet for stability.'),
        ),
      ],
      cooldown: {
        movements: [
          { name: 'Étirement pectoraux en porte', nameEn: 'Doorway Chest Stretch', duration: 45 },
          { name: 'Étirement grand dorsal', nameEn: 'Lat Stretch', duration: 45 },
          { name: 'Mobilisation cervicale douce', nameEn: 'Gentle Neck Mobilization', duration: 45 },
        ],
        totalDuration: 135,
      },
      equipment: ['Tapis (optionnel)'],
      totalRounds: 24,
      totalDuration: 30,
      calories: 110,
    },
    // 3C — Corps entier
    {
      id: 'deb-w3-s3',
      week: 3, order: 3,
      title: 'Corps entier haute intensité',
      titleEn: 'High Intensity Full Body',
      description: 'Step touch + superman, fente rotation + dead bug, squat jump low + mountain climber.',
      descriptionEn: 'Step touch + superman, lunge rotation + dead bug, low squat jump + mountain climber.',
      focus: ['Cardio', 'Puissance', 'Endurance musculaire'],
      focusEn: ['Cardio', 'Power', 'Muscular Endurance'],
      warmup: {
        movements: [
          { name: 'Marche rapide bras actifs', nameEn: 'Brisk Walk with Active Arms', duration: 60 },
          { name: 'Squats d\'activation', nameEn: 'Activation Squats', duration: 60 },
          { name: 'Fentes alternées lentes', nameEn: 'Slow Alternating Lunges', duration: 60 },
          { name: 'Sauts légers sur place', nameEn: 'Light Jumps in Place', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w3-s3-b1', STEP_TOUCH_CONSOL, SUPERMAN_CONSOL),
        block('deb-w3-s3-b2', FENTE_ROTATION, DEAD_BUG_LENt),
        block('deb-w3-s3-b3', SQUAT_JUMP_LOW, MOUNTAIN_CLIMBER_LENt),
      ],
      cooldown: {
        movements: [
          { name: 'Posture de l\'enfant', nameEn: 'Child\'s Pose', duration: 60 },
          { name: 'Pigeon yoga (chaque côté)', nameEn: 'Pigeon Pose (each side)', duration: 45 },
          { name: 'Respiration 4-7-8 × 4 cycles', nameEn: '4-7-8 Breathing × 4 cycles', duration: 60 },
        ],
        totalDuration: 165,
      },
      equipment: ['Tapis (optionnel)'],
      totalRounds: 24,
      totalDuration: 30,
      calories: 115,
    },
  ],
}

// ─── Week 4: Décharge & consolidation (2 blocs/séance) ──────

const week4: TabataWeek = {
  weekNumber: 4,
  title: 'Décharge & consolidation',
  titleEn: 'Deload & Consolidation',
  description: 'Retour à 2 blocs tabata. Volume réduit de 40%. C\'est pendant le repos que le corps consolide les adaptations.',
  descriptionEn: 'Back to 2 tabata blocks. Volume reduced by 40%. The body consolidates adaptations during rest.',
  focus: 'Technique parfaite, respiration consciente, ressenti musculaire',
  focusEn: 'Perfect technique, conscious breathing, muscle awareness',
  isDeload: true,
  sessions: [
    // 4A — Membres inférieurs (décharge)
    {
      id: 'deb-w4-s1',
      week: 4, order: 1,
      title: 'Membres inférieurs (décharge)',
      titleEn: 'Lower Body (Deload)',
      description: 'Focus sur la technique parfaite. Respiration coordonnée avec le mouvement.',
      descriptionEn: 'Focus on perfect technique. Breathing coordinated with movement.',
      focus: ['Technique', 'Respiration', 'Ressenti musculaire'],
      focusEn: ['Technique', 'Breathing', 'Muscle Awareness'],
      warmup: {
        movements: [
          { name: 'Marche sur place', nameEn: 'March in Place', duration: 60 },
          { name: 'Cercles de chevilles et hanches', nameEn: 'Ankle & Hip Circles', duration: 60 },
          { name: 'Squats lents conscience corporelle', nameEn: 'Slow Mindful Squats', duration: 60 },
          { name: 'Respiration diaphragmatique', nameEn: 'Diaphragmatic Breathing', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w4-s1-b1', SQUAT_CONSOLIDATION, PONT_FESSIER_CONSOL),
        block('deb-w4-s1-b2', FENTE_AVANT, DEAD_BUG),
      ],
      cooldown: {
        movements: [
          { name: 'Étirement quadriceps debout', nameEn: 'Standing Quad Stretch', duration: 45 },
          { name: 'Étirement ischio-jambiers', nameEn: 'Hamstring Stretch', duration: 45 },
          { name: 'Respiration guidée', nameEn: 'Guided Breathing', duration: 30 },
        ],
        totalDuration: 120,
      },
      equipment: ['Tapis (optionnel)'],
      totalRounds: 16,
      totalDuration: 25,
      calories: 70,
    },
    // 4B — Haut du corps (décharge)
    {
      id: 'deb-w4-s2',
      week: 4, order: 2,
      title: 'Haut du corps (décharge)',
      titleEn: 'Upper Body (Deload)',
      description: 'Qualité sur chaque répétition. Bilan personnel sur les exercices maîtrisés.',
      descriptionEn: 'Quality on every rep. Personal assessment of mastered exercises.',
      focus: ['Technique', 'Gainage profond', 'Contrôle'],
      focusEn: ['Technique', 'Deep Core', 'Control'],
      warmup: {
        movements: [
          { name: 'Rotations d\'épaules', nameEn: 'Shoulder Rotations', duration: 60 },
          { name: 'Ouvertures de poitrine', nameEn: 'Chest Openers', duration: 60 },
          { name: 'Cat-cow lent', nameEn: 'Slow Cat-Cow', duration: 60 },
          { name: 'Respiration diaphragmatique', nameEn: 'Diaphragmatic Breathing', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w4-s2-b1', POMPE_GENOUX_CONSOL, PLANCHE_CONSOL),
        block('deb-w4-s2-b2', BIRD_DOG, SUPERMAN),
      ],
      cooldown: {
        movements: [
          { name: 'Étirement pectoraux', nameEn: 'Chest Stretch', duration: 45 },
          { name: 'Étirement triceps', nameEn: 'Triceps Stretch', duration: 30 },
          { name: 'Étirement cervical', nameEn: 'Neck Stretch', duration: 30 },
        ],
        totalDuration: 105,
      },
      equipment: ['Tatis (optionnel)'],
      totalRounds: 16,
      totalDuration: 25,
      calories: 65,
    },
    // 4C — Corps entier bilan
    {
      id: 'deb-w4-s3',
      week: 4, order: 3,
      title: 'Corps entier — Bilan final',
      titleEn: 'Full Body — Final Assessment',
      description: 'Dernière séance du programme. Focus total sur la qualité. Quels exercices sont devenus faciles ?',
      descriptionEn: 'Final session of the program. Total focus on quality. Which exercises have become easy?',
      focus: ['Bilan global', 'Autonomie', 'Confiance'],
      focusEn: ['Overall Assessment', 'Autonomy', 'Confidence'],
      warmup: {
        movements: [
          { name: 'Marche active', nameEn: 'Active Walk', duration: 60 },
          { name: 'Mobilisation articulaire complète', nameEn: 'Full Joint Mobilization', duration: 60 },
          { name: 'Squats lents avec respiration', nameEn: 'Slow Squats with Breathing', duration: 60 },
          { name: 'Gainage léger', nameEn: 'Light Core Activation', duration: 60 },
        ],
        totalDuration: 240,
      },
      blocks: [
        block('deb-w4-s3-b1', SQUAT_CLASSIQUE, STEP_TOUCH),
        block('deb-w4-s3-b2', SUPERMAN, DEAD_BUG),
      ],
      cooldown: {
        movements: [
          { name: 'Posture de l\'enfant', nameEn: 'Child\'s Pose', duration: 60 },
          { name: 'Torsion vertébrale (chaque côté)', nameEn: 'Spinal Twist (each side)', duration: 45 },
          { name: 'Savasana + respiration guidée', nameEn: 'Savasana + Guided Breathing', duration: 60 },
        ],
        totalDuration: 165,
      },
      equipment: ['Tatis (optionnel)'],
      totalRounds: 16,
      totalDuration: 25,
      calories: 68,
    },
  ],
}

// ─── Program Export ─────────────────────────────────────────────

export const DEBUTANT_PROGRAM: TabataProgram = {
  id: 'debutant',
  title: 'Débutant',
  titleEn: 'Beginner',
  description: 'Apprendre le protocole tabata, construire les bases techniques de chaque mouvement fondamental, et terminer 12 séances sans douleur articulaire.',
  descriptionEn: 'Learn the tabata protocol, build technical foundations for each fundamental movement, and complete 12 sessions without joint pain.',
  tier: 'free',
  accentColor: '#00C896', // Energy green
  icon: 'seedling',
  durationWeeks: 4,
  sessionsPerWeek: 3,
  totalSessions: 12,
  equipment: {
    required: [],
    optional: ['Tapis de yoga'],
  },
  focusAreas: ['Squat', 'Gainage', 'Pompes', 'Équilibre', 'Mobilité'],
  focusAreasEn: ['Squat', 'Core', 'Push-ups', 'Balance', 'Mobility'],
  principles: [
    'Zéro impact les 2 premières semaines',
    'La technique avant l\'intensité',
    'Semaine 4 = décharge (volume réduit 40%)',
  ],
  principlesEn: [
    'Zero impact for the first 2 weeks',
    'Technique before intensity',
    'Week 4 = deload (40% volume reduction)',
  ],
  completionCriteria: [
    'Planche sur avant-bras tenue 30 secondes',
    '10 squats propres consécutifs sans douleur',
    '5 pompes complètes corps aligné',
    'Aucune douleur articulaire résiduelle',
  ],
  completionCriteriaEn: [
    'Hold forearm plank for 30 seconds',
    '10 clean consecutive squats without pain',
    '5 full push-ups with aligned body',
    'No residual joint pain after sessions',
  ],
  nextProgramId: 'intermediaire',
  weeks: [week1, week2, week3, week4],
}

/** All sessions flattened for quick lookup */
export const DEBUTANT_SESSIONS: TabataSession[] = DEBUTANT_PROGRAM.weeks.flatMap(w => w.sessions)
