/**
 * Programme Avancé — 4 semaines, 5 séances/semaine
 * Source: TabataKine_Guide_Complet.md — Section 4
 * Tier: PREMIUM
 */

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

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

// ─── Warmup / Cooldown Archetypes (from Guide Section 4) ────────

const WARMUP_LEGS: WarmupPhase = {
  movements: [
    { name: 'Jogging sur place progressif', nameEn: 'Progressive Jogging in Place', duration: 60 },
    { name: 'Leg swings dynamiques avant/arrière et latéraux', nameEn: 'Dynamic Leg Swings Front/Back and Lateral', duration: 60 },
    { name: 'Fentes dynamiques avec rotation du tronc', nameEn: 'Dynamic Lunges with Torso Rotation', duration: 60 },
    { name: 'Squat profond maintenu 3 sec', nameEn: 'Deep Squat Hold 3 Sec', duration: 60 },
    { name: 'Sauts bas rapides à deux pieds', nameEn: 'Low Rapid Two-foot Jumps', duration: 60 },
    { name: 'Clamshells rapides debout', nameEn: 'Fast Standing Clamshells', duration: 60 },
  ],
  totalDuration: 360,
}

const COOLDOWN_LEGS: CooldownPhase = {
  movements: [
    { name: 'Étirement ischio-jambiers dynamique puis statique', nameEn: 'Dynamic to Static Hamstring Stretch', duration: 90 },
    { name: 'Étirement quadriceps debout chaque jambe', nameEn: 'Standing Quad Stretch Each Leg', duration: 90 },
    { name: 'Automassage mollets', nameEn: 'Self-massage Calves', duration: 60 },
    { name: 'Respiration guidée récupération', nameEn: 'Guided Recovery Breathing', duration: 60 },
  ],
  totalDuration: 300,
}

const WARMUP_UPPER: WarmupPhase = {
  movements: [
    { name: 'Cercles d\'épaules complets avec résistance', nameEn: 'Full Shoulder Circles with Resistance', duration: 60 },
    { name: 'Face pulls avec élastique', nameEn: 'Face Pulls with Band', duration: 60 },
    { name: 'Pompes lentes descente 4 secondes', nameEn: 'Slow Push-ups 4-sec Descent', duration: 60 },
    { name: 'Dips lents sur chaise', nameEn: 'Slow Chair Dips', duration: 60 },
    { name: 'Planche dynamique haute↔basse', nameEn: 'Dynamic High↔Low Plank', duration: 60 },
    { name: 'Rotation thoracique en fente basse', nameEn: 'Thoracic Rotation in Lunge', duration: 60 },
  ],
  totalDuration: 360,
}

const COOLDOWN_UPPER: CooldownPhase = {
  movements: [
    { name: 'Étirement rotateurs externes épaule contre mur', nameEn: 'Wall External Rotator Stretch', duration: 60 },
    { name: 'Mobilisation thoracique sur rouleau', nameEn: 'Thoracic Foam Roller Mobilization', duration: 90 },
    { name: 'Étirement grand pectoral profond', nameEn: 'Deep Pectoral Stretch', duration: 60 },
    { name: 'Respiration guidée récupération', nameEn: 'Guided Recovery Breathing', duration: 60 },
  ],
  totalDuration: 270,
}

const WARMUP_FULL_BODY: WarmupPhase = {
  movements: [
    { name: 'Mountain climbers modérés', nameEn: 'Moderate Mountain Climbers', duration: 60 },
    { name: 'Squat jump amplitude partielle', nameEn: 'Partial Range Squat Jumps', duration: 60 },
    { name: 'Burpees sans saut (sprawl)', nameEn: 'No-jump Burpees (Sprawls)', duration: 60 },
    { name: 'High knees progressif', nameEn: 'Progressive High Knees', duration: 60 },
    { name: 'Mobilisation chevilles et poignets', nameEn: 'Ankle and Wrist Mobility', duration: 60 },
    { name: 'Hollow body hold 5 secondes x5', nameEn: 'Hollow Body Hold 5 Sec x5', duration: 60 },
  ],
  totalDuration: 360,
}

const COOLDOWN_FULL_BODY: CooldownPhase = {
  movements: [
    { name: 'Foam roller colonne vertébrale', nameEn: 'Spinal Foam Rolling', duration: 90 },
    { name: 'Supine twist chaque côté', nameEn: 'Supine Twist Each Side', duration: 90 },
    { name: 'Respiration 4-7-8 × 4 cycles', nameEn: '4-7-8 Breathing × 4 Cycles', duration: 90 },
    { name: 'Relaxation guidée', nameEn: 'Guided Relaxation', duration: 60 },
  ],
  totalDuration: 330,
}

const WARMUP_CORE: WarmupPhase = {
  movements: [
    { name: 'Respiration diaphragmatique', nameEn: 'Diaphragmatic Breathing', duration: 60 },
    { name: 'Cat-cow dynamique', nameEn: 'Dynamic Cat-Cow', duration: 60 },
    { name: 'Rotations bassin debout', nameEn: 'Standing Pelvic Rotations', duration: 60 },
    { name: 'Hollow body progressif 5×10 sec', nameEn: 'Progressive Hollow Body 5×10 Sec', duration: 60 },
    { name: 'Brettzel rotation thoracique', nameEn: 'Brettzel Thoracic Rotation', duration: 60 },
    { name: 'Squat profond asiatique', nameEn: 'Deep Asian Squat', duration: 60 },
  ],
  totalDuration: 360,
}

const COOLDOWN_CORE: CooldownPhase = {
  movements: [
    { name: 'Posture de l\'enfant', nameEn: 'Child\'s Pose', duration: 60 },
    { name: 'Torsion vertébrale au sol chaque côté', nameEn: 'Spinal Twist Each Side', duration: 60 },
    { name: 'Étirement cobra', nameEn: 'Cobra Stretch', duration: 60 },
    { name: 'Respiration diaphragmatique finale', nameEn: 'Final Diaphragmatic Breathing', duration: 60 },
  ],
  totalDuration: 240,
}

const ses = (id: string, week: number, order: number, title: string, titleEn: string, desc: string, descEn: string, focus: string[], focusEn: string[], blocks: TabataBlock[], totalRounds: number, totalDuration: number, calories: number, warmup: WarmupPhase, cooldown: CooldownPhase, eq: string[] = []): TabataSession => ({
  id, week, order, title, titleEn, description: desc, descriptionEn: descEn, focus, focusEn,
  warmup, blocks, cooldown,
  equipment: eq, totalRounds, totalDuration, calories,
})

const SQUAT_JUMP_180 = ex('Squat jump 180°', '180° Squat Jump', 'Réception en rotation sollicite fortement le LCA. Antécédent de genou = rester au squat jump classique.', 'Rotational landing stresses ACL heavily. Knee history = stick to regular squat jump.')
const FENTE_SAUTEE_EX = ex('Fente sautée', 'Jump Lunge', 'Réception absorbée sur 2–3 secondes.', 'Absorb landing over 2–3 seconds.')
const PISTOL_FULL = ex('Pistol squat complet', 'Full Pistol Squat', 'Talon qui se soulève = manque de mobilité de cheville. Tronc qui bascule = faiblesse du moyen fessier.', 'Heel lifting = ankle mobility deficit. Torso tilting = gluteus medius weakness.')
const NORDIC_CURL = ex('Nordic curl assisté', 'Assisted Nordic Curl', 'Cliniquement prouvé pour réduire les blessures ischio-jambiers de 50%. Même 3–4 reps contrôlées sont excellentes.', 'Clinically proven to reduce hamstring injuries by 50%. Even 3-4 controlled reps are excellent.')
const BOX_JUMP = ex('Box jump', 'Box Jump', 'Descendre en marchant — ne pas sauter en arrière. Sauter en arrière multiplie les contraintes articulaires.', 'Step down — never jump backward. Jumping down multiplies joint stress.')
const LATERAL_BOUND = ex('Lateral bound', 'Lateral Bound', 'Exercice de prévention des entorses par renforcement proprioceptif.', 'Sprain prevention exercise via proprioceptive strengthening.')
const BROAD_JUMP = ex('Broad jump + recul', 'Broad Jump + Return', 'Le recul contrôlé renforce les stabilisateurs de cheville sous fatigue.', 'Controlled return strengthens ankle stabilizers under fatigue.')
const SINGLE_LEG_DL = ex('Single leg deadlift', 'Single-leg Deadlift', 'Exercice fondamental de proprioception. Qualité > profondeur.', 'Fundamental proprioception exercise. Quality > depth.')
const ONE_ARM_PUSHUP = ex('Pompe 1 bras assistée', 'Assisted One-arm Push-up', 'L\'asymétrie révèle les faiblesses de stabilisation scapulaire.', 'Asymmetry reveals scapular stabilization weaknesses.')
const PIKE_PUSHUP = ex('Pike push-up', 'Pike Push-up', 'Simule le développé épaules. Contre-indiqué si syndrome d\'accrochage sous-acromial.', 'Simulates overhead press. Contraindicated with subacromial impingement.')
const PLYO_PUSHUP = ex('Pompe plyométrique', 'Plyometric Push-up', 'Poignets en parfait alignement — échauffement spécifique non négociable.', 'Perfect wrist alignment — specific warmup non-negotiable.')
const AROUND_WORLD = ex('Around the world planche', 'Around the World Plank', 'Ultra-exigeant pour les rotateurs de l\'épaule et les dentelés antérieurs.', 'Ultra-demanding for shoulder rotators and serratus anterior.')
const ARCHER_FULL = ex('Archer push-up complet', 'Full Archer Push-up', 'Maintenir l\'alignement corps-bras porteur parfait.', 'Maintain perfect body-supporting arm alignment.')
const SIDE_PLANK_ROT = ex('Planche latérale rotation', 'Side Plank with Rotation', 'Sollicite obliques, carré des lombes et rotateurs d\'épaule simultanément.', 'Targets obliques, quadratus lumborum and shoulder rotators simultaneously.')
const PSEUDO_PLANCHE = ex('Pseudo planche push-up', 'Pseudo Planche Push-up', 'Charge extrême sur les triceps et pectoraux inférieurs.', 'Extreme load on triceps and lower pectorals.')
const SUPERMAN_BEAT = ex('Superman battement', 'Superman Flutter', 'Travail des extenseurs dorsaux sous fatigue.', 'Thoracic extensor work under fatigue.')
const BURPEE_TUCK = ex('Burpee saut groupé', 'Tuck Jump Burpee', 'Atterrir genoux fléchis, jamais en extension. Charge lombaire à la réception.', 'Land with bent knees, never extended. Lumbar load on landing.')
const V_UP = ex('V-up', 'V-up', 'Si douleur au bas du dos : revenir au hollow body.', 'If lower back pain: return to hollow body.')
const TUCK_JUMP = ex('Tuck jump', 'Tuck Jump', 'Si syndrome essuie-glace (IT band) : substituer par jumping squats.', 'If IT band syndrome: substitute with jumping squats.')
const MC_CROISE = ex('Mountain climber croisé', 'Cross-body Mountain Climber', 'Plus difficile que le MC classique car la rotation engage les obliques.', 'Harder than regular MC as rotation engages obliques.')
const DEVILS_PRESS = ex('Devil\'s press poids de corps', 'Bodyweight Devil\'s Press', 'Enchaînement fluide entre les phases. Pas de pause entre le grenouille et le relever.', 'Fluid transition between phases. No pause between frog and stand.')
const BEAR_CRAWL_DEPL = ex('Bear crawl en déplacement', 'Traveling Bear Crawl', 'Gainage parfait malgré la vitesse. Genoux à 3 cm du sol.', 'Perfect core despite speed. Knees 3cm off floor.')
const SPRAWL = ex('Sprawl', 'Sprawl', 'La projection vers le bas doit être contrôlée — ne jamais s\'écraser.', 'Downward projection must be controlled — never crash.')
const HOLLOW_ROCK = ex('Hollow body rocks', 'Hollow Body Rocks', 'Continuité du gainage pendant le balancement est l\'objectif.', 'Core continuity during rocking is the goal.')
const HANDSTAND_PU = ex('Handstand push-up mur', 'Wall Handstand Push-up', 'Vérifier l\'absence de douleur cervicale. Ne jamais toucher le sol avec force.', 'Verify no cervical pain. Never forcefully touch floor.')
const SINGLE_LEG_BURPEE = ex('Single leg burpee', 'Single-leg Burpee', 'Test ultime de force, coordination et proprioception.', 'Ultimate test of strength, coordination and proprioception.')
const DRAGON_FLAG = ex('Dragon flag partiel', 'Partial Dragon Flag', 'Ne jamais forcer si douleur lombaire. L\'exercice de Bruce Lee.', 'Never force with lower back pain. Bruce Lee\'s exercise.')
const COPENHAGEN = ex('Copenhagen plank', 'Copenhagen Plank', 'Prévention des adducteurs la plus efficace existante.', 'Most effective adductor prevention exercise in existence.')
const BURPEE_LATERAL = ex('Burpee + saut latéral', 'Burpee + Lateral Jump', 'Augmente l\'impact cardiovasculaire et la coordination.', 'Increases cardiovascular impact and coordination.')

// ─── Week 1: Bascule vers la complexité (4 blocs, 5 sessions) ──

const w1: TabataWeek = {
  weekNumber: 1, title: 'Bascule vers la complexité', titleEn: 'Shift to Complexity',
  description: '4 blocs/séance, ~45 min. Mouvements unilatéraux + plyométrie avancée.',
  descriptionEn: '4 blocks/session, ~45 min. Unilateral movements + advanced plyometrics.',
  focus: 'Mouvements complexes sous fatigue, unilatéral systématique', focusEn: 'Complex movements under fatigue, systematic unilateral work', isDeload: false,
  sessions: [
    ses('avc-w1-s1', 1, 1, 'Jambes explosifs', 'Explosive Legs', 'Squat 180°, pistol squat, Nordic curl, box jump.', '180° squat, pistol squat, Nordic curl, box jump.',
      ['Puissance', 'Unilatéral', 'Plyométrie'], ['Power', 'Unilateral', 'Plyometrics'],
      [block('avc-w1-s1-b1', SQUAT_JUMP_180, PISTOL_FULL), block('avc-w1-s1-b2', NORDIC_CURL, LATERAL_BOUND), block('avc-w1-s1-b3', BOX_JUMP, SINGLE_LEG_DL), block('avc-w1-s1-b4', BROAD_JUMP, SUPERMAN_BEAT)],
      32, 45, 200, WARMUP_LEGS, COOLDOWN_LEGS, ['Surface surélevée stable']),
    ses('avc-w1-s2', 1, 2, 'Haut athlétique', 'Athletic Upper Body', 'Pompe 1 bras, pike push-up, pompe plyo, archer.',
      'One-arm push-up, pike push-up, plyo push-up, archer.',
      ['Force', 'Stabilité scapulaire'], ['Strength', 'Scapular Stability'],
      [block('avc-w1-s2-b1', ONE_ARM_PUSHUP, PIKE_PUSHUP), block('avc-w1-s2-b2', PLYO_PUSHUP, AROUND_WORLD), block('avc-w1-s3-b3', ARCHER_FULL, SIDE_PLANK_ROT), block('avc-w1-s2-b4', PSEUDO_PLANCHE, SUPERMAN_BEAT)],
      32, 45, 185, WARMUP_UPPER, COOLDOWN_UPPER),
    ses('avc-w1-s3', 1, 3, 'Corps entier HIIT', 'Full Body HIIT', 'Burpee groupé, V-up, tuck jump, MC croisé.',
      'Tuck burpee, V-up, tuck jump, cross-body MC.',
      ['Cardio max', 'Composé'], ['Max Cardio', 'Compound'],
      [block('avc-w1-s3-b1', BURPEE_TUCK, V_UP), block('avc-w1-s3-b2', TUCK_JUMP, MC_CROISE), block('avc-w1-s3-b3', DEVILS_PRESS, BEAR_CRAWL_DEPL), block('avc-w1-s3-b4', SPRAWL, HOLLOW_ROCK)],
      32, 45, 210, WARMUP_FULL_BODY, COOLDOWN_FULL_BODY),
    ses('avc-w1-s4', 1, 4, 'Gainage profond + mobilité', 'Deep Core + Mobility', 'Hollow body, Copenhagen, 90/90, Brettzel.',
      'Hollow body, Copenhagen, 90/90, Brettzel.',
      ['Gainage', 'Mobilité', 'Récupération'], ['Core', 'Mobility', 'Recovery'],
      [], 0, 35, 50, WARMUP_CORE, COOLDOWN_CORE),
    ses('avc-w1-s5', 1, 5, 'MetCon 20 min AMRAP', '20-min AMRAP MetCon', '5 burpees, 10 squat jumps, 10 MC croisés, 5 pompes explosives, 10 V-ups en boucle.',
      '5 burpees, 10 squat jumps, 10 cross-body MC, 5 explosive push-ups, 10 V-ups on loop.',
      ['Endurance de force', 'MetCon'], ['Strength Endurance', 'MetCon'],
      [block('avc-w1-s5-b1', BURPEE_TUCK, SQUAT_JUMP_180), block('avc-w1-s5-b2', MC_CROISE, PLYO_PUSHUP), block('avc-w1-s5-b3', V_UP, HOLLOW_ROCK), block('avc-w1-s5-b4', TUCK_JUMP, SPRAWL)],
      32, 20, 150, WARMUP_FULL_BODY, COOLDOWN_FULL_BODY),
  ],
}

// ─── Week 2: Densification (5 blocs, 5 sessions) ─────────────

const w2: TabataWeek = {
  weekNumber: 2, title: 'Densification', titleEn: 'Densification',
  description: '5 blocs/séance, ~50 min. Handstand push-up, single leg burpee, dragon flag.',
  descriptionEn: '5 blocks/session, ~50 min. Handstand push-up, single-leg burpee, dragon flag.',
  focus: 'Nouveaux mouvements très avancés, volume maximal', focusEn: 'Very advanced new movements, max volume', isDeload: false,
  sessions: [
    ses('avc-w2-s1', 2, 1, 'Jambes puissance max', 'Max Leg Power', 'Pistol + box jump + Nordic + lateral bound + broad jump.',
      'Pistol + box jump + Nordic + lateral bound + broad jump.',
      ['Puissance', 'Explosivité'], ['Power', 'Explosiveness'],
      [block('avc-w2-s1-b1', PISTOL_FULL, NORDIC_CURL), block('avc-w2-s1-b2', BOX_JUMP, LATERAL_BOUND), block('avc-w2-s1-b3', BROAD_JUMP, SINGLE_LEG_DL), block('avc-w2-s1-b4', SQUAT_JUMP_180, SUPERMAN_BEAT), block('avc-w2-s1-b5', SINGLE_LEG_BURPEE, HOLLOW_ROCK)],
      40, 50, 250, WARMUP_LEGS, COOLDOWN_LEGS, ['Surface surélevée']),
    ses('avc-w2-s2', 2, 2, 'Haut force max', 'Max Upper Strength', 'Handstand PU + archer + plyo + pseudo planche + side plank.',
      'Handstand PU + archer + plyo + pseudo planche + side plank.',
      ['Force maximale', 'Épaules'], ['Max Strength', 'Shoulders'],
      [block('avc-w2-s2-b1', HANDSTAND_PU, PIKE_PUSHUP), block('avc-w2-s2-b2', ARCHER_FULL, ONE_ARM_PUSHUP), block('avc-w2-s2-b3', PLYO_PUSHUP, AROUND_WORLD), block('avc-w2-s2-b4', PSEUDO_PLANCHE, SIDE_PLANK_ROT), block('avc-w2-s2-b5', DRAGON_FLAG, SUPERMAN_BEAT)],
      40, 50, 230, WARMUP_UPPER, COOLDOWN_UPPER),
    ses('avc-w2-s3', 2, 3, 'Cardio avancé', 'Advanced Cardio', 'Single leg burpee + tuck jump + devil\'s press + sprawl + bear crawl.',
      'Single-leg burpee + tuck jump + devil\'s press + sprawl + bear crawl.',
      ['Cardio extrême', 'Endurance'], ['Extreme Cardio', 'Endurance'],
      [block('avc-w2-s3-b1', SINGLE_LEG_BURPEE, MC_CROISE), block('avc-w2-s3-b2', TUCK_JUMP, DEVILS_PRESS), block('avc-w2-s3-b3', SPRAWL, BEAR_CRAWL_DEPL), block('avc-w2-s3-b4', BURPEE_TUCK, V_UP), block('avc-w2-s3-b5', HOLLOW_ROCK, SQUAT_JUMP_180)],
      40, 50, 260, WARMUP_FULL_BODY, COOLDOWN_FULL_BODY),
    ses('avc-w2-s4', 2, 4, 'Gainage avancé', 'Advanced Core', 'Dragon flag + Copenhagen + hollow body + V-up + pseudo planche.',
      'Dragon flag + Copenhagen + hollow body + V-up + pseudo planche.',
      ['Gainage profond', 'Stabilité'], ['Deep Core', 'Stability'],
      [block('avc-w2-s4-b1', DRAGON_FLAG, COPENHAGEN), block('avc-w2-s4-b2', HOLLOW_ROCK, V_UP), block('avc-w2-s4-b3', SIDE_PLANK_ROT, ARCHER_FULL), block('avc-w2-s4-b4', PSEUDO_PLANCHE, SUPERMAN_BEAT), block('avc-w2-s4-b5', NORDIC_CURL, HOLLOW_ROCK)],
      40, 50, 220, WARMUP_CORE, COOLDOWN_CORE),
    ses('avc-w2-s5', 2, 5, 'Mix force + puissance', 'Strength + Power Mix', 'Pistol + handstand PU + single leg burpee + plyo push-up + broad jump.',
      'Pistol + handstand PU + single-leg burpee + plyo push-up + broad jump.',
      ['Force + puissance'], ['Strength + power'],
      [block('avc-w2-s5-b1', PISTOL_FULL, HANDSTAND_PU), block('avc-w2-s5-b2', SINGLE_LEG_BURPEE, PLYO_PUSHUP), block('avc-w2-s5-b3', BROAD_JUMP, DRAGON_FLAG), block('avc-w2-s5-b4', ARCHER_FULL, V_UP), block('avc-w2-s5-b5', SQUAT_JUMP_180, HOLLOW_ROCK)],
      40, 50, 255, WARMUP_FULL_BODY, COOLDOWN_FULL_BODY),
  ],
}

// ─── Week 3: Pic d'intensité + Complexes (5 blocs) ───────────

const w3: TabataWeek = {
  weekNumber: 3, title: 'Pic d\'intensité & Complexes', titleEn: 'Peak Intensity & Complexes',
  description: '5 blocs + complexes. 2 exercices enchaînés sans pause = 1 répétition.',
  descriptionEn: '5 blocks + complexes. 2 exercises chained without rest = 1 rep.',
  focus: 'Complexes, intensité maximale', focusEn: 'Complexes, maximum intensity', isDeload: false,
  sessions: [
    ses('avc-w3-s1', 3, 1, 'Complexes jambes', 'Lower Body Complexes', 'Squat jump+fente sautée, pistol+Nordic, box+jump lateral.',
      'Squat jump+jump lunge, pistol+Nordic, box+lateral jump.',
      ['Complexes', 'Puissance'], ['Complexes', 'Power'],
      [block('avc-w3-s1-b1', SQUAT_JUMP_180, FENTE_SAUTEE_EX), block('avc-w3-s1-b2', PISTOL_FULL, NORDIC_CURL), block('avc-w3-s1-b3', BOX_JUMP, LATERAL_BOUND), block('avc-w3-s1-b4', BROAD_JUMP, SINGLE_LEG_DL), block('avc-w3-s1-b5', SINGLE_LEG_BURPEE, HOLLOW_ROCK)],
      40, 50, 265, WARMUP_LEGS, COOLDOWN_LEGS, ['Surface surélevée']),
    ses('avc-w3-s2', 3, 2, 'Complexes haut', 'Upper Body Complexes', 'Pompe plyo+MC croisé, archer+side plank, handstand+pike.',
      'Plyo push-up+cross MC, archer+side plank, handstand+pike.',
      ['Complexes', 'Force'], ['Complexes', 'Strength'],
      [block('avc-w3-s2-b1', PLYO_PUSHUP, MC_CROISE), block('avc-w3-s2-b2', ARCHER_FULL, SIDE_PLANK_ROT), block('avc-w3-s2-b3', HANDSTAND_PU, PIKE_PUSHUP), block('avc-w3-s2-b4', ONE_ARM_PUSHUP, DRAGON_FLAG), block('avc-w3-s2-b5', PSEUDO_PLANCHE, SUPERMAN_BEAT)],
      40, 50, 245, WARMUP_UPPER, COOLDOWN_UPPER),
    ses('avc-w3-s3', 3, 3, 'Complexes corps entier', 'Full Body Complexes', 'Burpee+broad jump, sprawl+tuck jump, devil\'s press+V-up.',
      'Burpee+broad jump, sprawl+tuck jump, devil\'s press+V-up.',
      ['Complexes', 'Cardio max'], ['Complexes', 'Max cardio'],
      [block('avc-w3-s3-b1', BURPEE_LATERAL, BROAD_JUMP), block('avc-w3-s3-b2', SPRAWL, TUCK_JUMP), block('avc-w3-s3-b3', DEVILS_PRESS, V_UP), block('avc-w3-s3-b4', BEAR_CRAWL_DEPL, HOLLOW_ROCK), block('avc-w3-s3-b5', SINGLE_LEG_BURPEE, SQUAT_JUMP_180)],
      40, 50, 275, WARMUP_FULL_BODY, COOLDOWN_FULL_BODY),
    ses('avc-w3-s4', 3, 4, 'Gainage + MetCon', 'Core + MetCon', 'Copenhagen+dragon flag, puis circuit rapide.',
      'Copenhagen+dragon flag, then fast circuit.',
      ['Gainage', 'MetCon'], ['Core', 'MetCon'],
      [block('avc-w3-s4-b1', COPENHAGEN, DRAGON_FLAG), block('avc-w3-s4-b2', HOLLOW_ROCK, V_UP), block('avc-w3-s4-b3', BURPEE_TUCK, MC_CROISE), block('avc-w3-s4-b4', TUCK_JUMP, PLYO_PUSHUP), block('avc-w3-s4-b5', SPRAWL, NORDIC_CURL)],
      40, 50, 250, WARMUP_CORE, COOLDOWN_CORE),
    ses('avc-w3-s5', 3, 5, 'MetCon étendu 25 min', 'Extended 25-min MetCon', 'Circuit maximaliste en continu pendant 25 minutes.',
      'Maximalist continuous circuit for 25 minutes.',
      ['Endurance maximale'], ['Maximum endurance'],
      [block('avc-w3-s5-b1', BURPEE_LATERAL, SQUAT_JUMP_180), block('avc-w3-s5-b2', PLYO_PUSHUP, MC_CROISE), block('avc-w3-s5-b3', BROAD_JUMP, V_UP), block('avc-w3-s5-b4', SINGLE_LEG_BURPEE, HOLLOW_ROCK), block('avc-w3-s5-b5', SPRAWL, TUCK_JUMP)],
      40, 25, 170, WARMUP_FULL_BODY, COOLDOWN_FULL_BODY),
  ],
}

// ─── Week 4: Décharge & tests (3 blocs, 5 sessions) ──────────

const w4: TabataWeek = {
  weekNumber: 4, title: 'Décharge & Tests finaux', titleEn: 'Deload & Final Tests',
  description: '3 blocs/séance. Exercices maîtrisés, focus technique. Tests de performance.',
  descriptionEn: '3 blocks/session. Mastered exercises, technique focus. Performance tests.',
  focus: 'Bilan, tests de performance, récupération', focusEn: 'Assessment, performance tests, recovery', isDeload: true,
  sessions: [
    ses('avc-w4-s1', 4, 1, 'Jambes bilan', 'Leg Assessment', 'Squat jump, pistol squat, box jump — qualité max.',
      'Squat jump, pistol squat, box jump — max quality.',
      ['Bilan jambes'], ['Leg assessment'],
      [block('avc-w4-s1-b1', SQUAT_JUMP_180, PISTOL_FULL), block('avc-w4-s1-b2', BOX_JUMP, NORDIC_CURL), block('avc-w4-s1-b3', SINGLE_LEG_DL, SUPERMAN_BEAT)],
      24, 35, 170, WARMUP_LEGS, COOLDOWN_LEGS, ['Surface surélevée']),
    ses('avc-w4-s2', 4, 2, 'Haut bilan', 'Upper Assessment', 'Archer, handstand PU, plyo — qualité max.',
      'Archer, handstand PU, plyo — max quality.',
      ['Bilan haut du corps'], ['Upper body assessment'],
      [block('avc-w4-s2-b1', ARCHER_FULL, HANDSTAND_PU), block('avc-w4-s2-b2', PLYO_PUSHUP, SIDE_PLANK_ROT), block('avc-w4-s2-b3', ONE_ARM_PUSHUP, DRAGON_FLAG)],
      24, 35, 155, WARMUP_UPPER, COOLDOWN_UPPER),
    ses('avc-w4-s3', 4, 3, 'Cardio bilan', 'Cardio Assessment', 'Burpee endurance 3 min + sprint.',
      'Burpee endurance 3 min + sprint.',
      ['Bilan cardio'], ['Cardio assessment'],
      [block('avc-w4-s3-b1', BURPEE_TUCK, MC_CROISE), block('avc-w4-s3-b2', TUCK_JUMP, BEAR_CRAWL_DEPL), block('avc-w4-s3-b3', SPRAWL, HOLLOW_ROCK)],
      24, 35, 180, WARMUP_FULL_BODY, COOLDOWN_FULL_BODY),
    ses('avc-w4-s4', 4, 4, 'Mobilité finale', 'Final Mobility', 'Stretching complet, mobilité articulaire, respiration.',
      'Full stretching, joint mobility, breathing.',
      ['Récupération', 'Mobilité'], ['Recovery', 'Mobility'],
      [], 0, 30, 40, WARMUP_CORE, COOLDOWN_CORE),
    ses('avc-w4-s5', 4, 5, 'Bilan global', 'Overall Assessment', 'Tests finaux: burpees 3min, pistol G/D, broad jump, planche+MC 2min.',
      'Final tests: 3-min burpees, L/R pistol, broad jump, plank+MC 2min.',
      ['Tests de passage'], ['Passing tests'],
      [block('avc-w4-s5-b1', PISTOL_FULL, HOLLOW_ROCK), block('avc-w4-s5-b2', BURPEE_TUCK, BROAD_JUMP), block('avc-w4-s5-b3', ARCHER_FULL, COPENHAGEN)],
      24, 35, 165, WARMUP_FULL_BODY, COOLDOWN_FULL_BODY),
  ],
}

export const AVANCE_PROGRAM: TabataProgram = {
  id: 'avance', title: 'Avancé', titleEn: 'Advanced',
  description: 'Mouvements complexes sous fatigue, travail unilatéral systématique, préparation physique de haut niveau.',
  descriptionEn: 'Complex movements under fatigue, systematic unilateral work, high-level physical preparation.',
  tier: 'premium', accentColor: '#FF453A', icon: 'bolt',
  durationWeeks: 4, sessionsPerWeek: 5, totalSessions: 20,
  equipment: { required: [], optional: ['Surface surélevée stable', 'Mur'] },
  focusAreas: ['Plyométrie avancée', 'Unilatéral', 'Complexes', 'MetCon'],
  focusAreasEn: ['Advanced Plyometrics', 'Unilateral', 'Complexes', 'MetCon'],
  principles: [
    'Si technique s\'effondre round 5 : réduire à exercice seul',
    'Fatigue neurologique = réduire d\'une séance',
    'JAMAQUE sacrifier la technique sous fatigue',
  ],
  principlesEn: [
    'If technique collapses at round 5: reduce to single exercise',
    'Neurological fatigue = reduce by one session',
    'NEVER sacrifice technique under fatigue',
  ],
  completionCriteria: [
    '35+ burpees en 3 minutes',
    '5 pistol squats propres G et D',
    'Planche + MC croisé 2 minutes',
    'Broad jump progression vs test intermédiaire',
    'Asymétrie G/D < 20% partout',
  ],
  completionCriteriaEn: [
    '35+ burpees in 3 minutes',
    '5 clean pistol squats L and R',
    'Plank + cross MC for 2 minutes',
    'Broad jump improvement vs intermediate test',
    'L/R asymmetry < 20% everywhere',
  ],
  weeks: [w1, w2, w3, w4],
}

export const AVANCE_SESSIONS: TabataSession[] = AVANCE_PROGRAM.weeks.flatMap(w => w.sessions)
