/**
 * Programme Bureau — 4 semaines, 3-4 séances/semaine
 * Source: TabataKine_Guide_Complet.md, Section 7
 * Tier: PREMIUM
 *
 * Contraintes de conception:
 * - Silence : pas de sauts, pas d'impacts, pas de chutes au sol
 * - Pas de sol : tous les exercices debout ou assis sur une chaise
 * - Pas de sueur visible : intensite calibree
 * - 10 ou 20 min max
 * - Tenue de bureau : aucun equipement
 *
 * 3 formats:
 * - Format A (10 min, 4 blocs de 2 min = 8 rounds): Assis/desk exercises
 * - Format B (20 min, 5 blocs de 4 min = 40 rounds): Standing exercises
 * - Format C (20 min, walking meeting): Audio-guided walking
 *
 * Semaine 4 = decharge + autonomie
 */

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,
})

// ─── Format A Exercises (Seated / Desk) ────────────────────────

const CONTRACTION_ABDO_ISO = ex(
  'Contraction abdominale isometrique', 'Isometric Abdominal Contraction',
  "C'est le transverse. Le contracter regulierement en position assise combat directement les douleurs lombaires liees a la sedentarite.",
  'This targets the transverse abdominis. Regular contraction while seated directly fights lower back pain from sedentary habits.',
  {
    modification: 'Contracter sur 5 sec au lieu de 20',
    modificationEn: 'Contract for 5 sec instead of 20',
    progression: 'Ajouter une inclinaison du bassin en retroversion',
    progressionEn: 'Add a posterior pelvic tilt',
  },
)

const SERRAGE_FESSIER = ex(
  'Serrage fessier (assis)', 'Seated Glute Squeeze',
  'Contre la retroversion du bassin liee a la position assise prolongee. Invisible de l\'exterieur.',
  'Counteracts pelvic posterior tilt from prolonged sitting. Invisible to others.',
  {
    modification: 'Serrer un seul cote a la fois',
    modificationEn: 'Squeeze one side at a time',
    progression: 'Serrer + soulever legerement le bassin du siege',
    progressionEn: 'Squeeze + slightly lift pelvis off the seat',
  },
)

const EXTENSION_JAMBE_ASSIS = ex(
  'Extension de jambe (assis)', 'Seated Leg Extension',
  'Renforcement du quadriceps. Ajouter une contraction du pied (orteils vers soi) pour activer les tibias anterieurs.',
  'Quadriceps strengthening. Add a foot contraction (toes toward you) to activate tibialis anterior.',
  {
    modification: 'Extension partielle, jambe a moitie',
    modificationEn: 'Partial extension, leg halfway up',
    progression: 'Maintenir 3 sec en haut + flexion du pied',
    progressionEn: 'Hold 3 sec at top + dorsiflex foot',
  },
)

const ELEVATION_TALONS_ASSIS = ex(
  'Elevation de talons assis', 'Seated Heel Raise',
  'Active la pompe veineuse des jambes. Prevention des jambes lourdes et des varices.',
  'Activates the leg venous pump. Prevents heavy legs and varicose veins.',
  {
    modification: 'Elever un talon a la fois',
    modificationEn: 'Raise one heel at a time',
    progression: 'Elever les deux talons + maintenir 3 sec en haut',
    progressionEn: 'Raise both heels + hold 3 sec at top',
  },
)

const WALL_SIT = ex(
  'Wall sit (chaise invisible)', 'Wall Sit',
  'Aucun bruit, aucun mouvement visible de l\'exterieur, intensite maximale pour les quadriceps. Respirer calmement.',
  'No noise, no visible movement from outside, maximum intensity for quadriceps. Breathe calmly.',
  {
    modification: 'Angle de 135° au lieu de 90°',
    modificationEn: '135° angle instead of 90°',
    progression: 'Ajouter une contraction abdo en position basse',
    progressionEn: 'Add an ab contraction at the bottom',
  },
)

const ELEVATION_TALONS_DEBOUT = ex(
  'Elevation de talons debout', 'Standing Heel Raise',
  'Renforcement des soleaires et gastrocnemiens. Bras tendus devant soi pour l\'equilibre si necessaire.',
  'Strengthens soleus and gastrocnemius. Arms extended forward for balance if needed.',
  {
    modification: 'Tenir un support pour l\'equilibre',
    modificationEn: 'Hold a support for balance',
    progression: 'Unilateral — un pied a la fois',
    progressionEn: 'Unilateral — one foot at a time',
  },
)

const POMPES_BUREAU = ex(
  'Pompes contre le bureau', 'Desk Push-ups',
  'S\'assurer que le bureau est stable avant de commencer. Plus incline = plus facile.',
  'Make sure the desk is stable before starting. More incline = easier.',
  {
    modification: 'Mains sur le mur (plus vertical)',
    modificationEn: 'Hands on wall (more vertical)',
    progression: 'Mains sur un support plus bas (chaise)',
    progressionEn: 'Hands on a lower surface (chair)',
  },
)

const PULL_APART = ex(
  'Pull apart imaginaire', 'Imaginary Pull Apart',
  'Contre le syndrome de l\'epaule roulee du bureau. Ouvrir la poitrine au maximum.',
  'Counteracts desk slouch / rounded shoulders. Open the chest as wide as possible.',
  {
    modification: 'Bras plies a 90° au lieu de tendus',
    modificationEn: 'Bent arms at 90° instead of straight',
    progression: 'Ajouter une rotation externe des paumes vers le plafond',
    progressionEn: 'Add external rotation of palms toward ceiling',
  },
)

// ─── Format B Exercises (Standing, Zero Impact) ────────────────

const SQUAT_SILENCIEUX = ex(
  'Squat silencieux tempo 3-3', 'Silent Squat Tempo 3-3',
  'Tempo 3 sec descente / 3 sec montee pour rester sous le seuil de transpiration tout en maintenant l\'efficacite musculaire.',
  '3 sec down / 3 sec up tempo to stay below the sweat threshold while maintaining muscle effectiveness.',
  {
    modification: 'Squat 1/4 avec tempo 2-2',
    modificationEn: 'Quarter squat with 2-2 tempo',
    progression: 'Ajouter 1 sec de maintien en bas',
    progressionEn: 'Add 1 sec hold at the bottom',
  },
)

const FENTE_STATIQUE_ROTATION = ex(
  'Fente statique avec rotation de buste', 'Static Lunge with Torso Rotation',
  'Fente basse tenue + rotation du tronc vers le genou avant. Mobilite thoracique et renforcement simultanes.',
  'Hold low lunge + rotate torso toward front knee. Thoracic mobility and strengthening simultaneously.',
  {
    modification: 'Fente haute (angle reduit)',
    modificationEn: 'High lunge (reduced angle)',
    progression: 'Ajouter les bras tendus au-dessus de la tete pendant la rotation',
    progressionEn: 'Add arms extended overhead during rotation',
  },
)

const BUREAU_DIPS = ex(
  'Bureau dips', 'Desk Dips',
  'Mains sur le bureau derriere soi, corps decolle, flechir les coudes. Verifier la stabilite du bureau avant de commencer.',
  'Hands on desk behind you, body lifted, bend elbows. Check desk stability before starting.',
  {
    modification: 'Jambes pliees, pieds plus proches',
    modificationEn: 'Bent legs, feet closer',
    progression: 'Jambes tendues, pieds plus eloignes',
    progressionEn: 'Straight legs, feet further out',
  },
)

const CALF_RAISES_FERMES = ex(
  'Calf raises yeux fermes', 'Eyes-closed Calf Raises',
  'Montees sur la pointe des pieds avec les yeux fermes. Double effet : renforcement + proprioception.',
  'Calf raises with eyes closed. Double benefit: strengthening + proprioception.',
  {
    modification: 'Garder les yeux ouverts, tenir un support',
    modificationEn: 'Keep eyes open, hold a support',
    progression: 'Unilateral — un pied a la fois, yeux fermes',
    progressionEn: 'Unilateral — one foot at a time, eyes closed',
  },
)

const ISOMETRIE_FESSIERS_DEBOUT = ex(
  'Isometrie fessiers debout', 'Standing Glute Isometric Hold',
  'Contracter les fessiers alternativement sans bouger les jambes. Activation du moyen fessier inhibe par la position assise.',
  'Contract glutes alternately without moving legs. Activates gluteus medius inhibited by prolonged sitting.',
  {
    modification: 'Contractions rapides (2 sec) au lieu de maintenues',
    modificationEn: 'Quick contractions (2 sec) instead of holds',
    progression: 'Ajouter une micro-elevee du talon du cote actif',
    progressionEn: 'Add a micro heel lift on the active side',
  },
)

const ROTATION_BUSTE_RAPIDE = ex(
  'Rotation de buste rapide', 'Fast Torso Rotation',
  'Bras croises sur la poitrine, rotation droite-gauche rapide. Active les obliques et echauffe les disques intervertebraux.',
  'Arms crossed on chest, fast right-left rotation. Activates obliques and warms up intervertebral discs.',
  {
    modification: 'Rotation lente et controlee',
    modificationEn: 'Slow and controlled rotation',
    progression: 'Bras tendus sur les cotes pour augmenter l\'amplitude',
    progressionEn: 'Arms extended to sides for greater range of motion',
  },
)

// ─── Format C Exercises (Walking / Audio-only) ─────────────────

const MARCHE_RAPIDE = ex(
  'Marche rapide', 'Brisk Walking',
  'La marche active a 6-7 km/h suffit a atteindre 70-80% de la FC max. Amplement suffisant pour les benefices cardiovasculaires.',
  'Active walking at 6-7 km/h reaches 70-80% of max HR. Sufficient for cardiovascular HIIT benefits.',
)

const MARCHE_GENOUX_HAUTS = ex(
  'Marche genoux hauts', 'High-knee Walking',
  'Lever les genoux a hauteur des hanches en marchant. Intensite elevee sans impact.',
  'Lift knees to hip height while walking. High intensity without impact.',
)

const MARCHE_FENTE = ex(
  'Marche en fente', 'Lunge Walking',
  'Pas le plus long possible. Tronc droit, genou avant stable.',
  'Longest stride possible. Torso upright, front knee stable.',
)

const MONTEE_ESCALIERS = ex(
  'Montee d\'escaliers', 'Stair Climbing',
  'Si disponibles. Monter en marchant rapide, descendre en marchant normale.',
  'If available. Walk up briskly, walk down normally.',
)

const MARCHE_NORMALE = ex(
  'Marche normale (recuperation)', 'Normal Walking (recovery)',
  'Marche naturelle pour recuperation active entre les phases intenses.',
  'Natural walking for active recovery between intense phases.',
)

// ─── Format A Warmup & Cooldown ────────────────────────────────

const FORMAT_A_WARMUP = {
  movements: [
    { name: 'Cercles de poignets dans les deux sens', nameEn: 'Wrist Circles Both Directions', duration: 20 },
    { name: 'Mobilisation cervicale : inclinaisons et rotations douces', nameEn: 'Neck Mobilization: Gentle Tilts & Rotations', duration: 20 },
    { name: 'Ouverture de poitrine : bras en arriere, omoplates rapprochees', nameEn: 'Chest Opener: Arms Back, Squeeze Shoulder Blades', duration: 20 },
  ],
  totalDuration: 60,
}

const FORMAT_A_COOLDOWN = {
  movements: [
    { name: 'Etirement cervical lateral doux (chaque cote)', nameEn: 'Gentle Lateral Neck Stretch (each side)', duration: 15 },
    { name: 'Etirement des poignets (extenseurs et flechisseurs)', nameEn: 'Wrist Stretch (extensors and flexors)', duration: 15 },
    { name: '3 grandes respirations diaphragmatiques', nameEn: '3 Deep Diaphragmatic Breaths', duration: 30 },
  ],
  totalDuration: 60,
}

// ─── Format B Warmup & Cooldown ────────────────────────────────

const FORMAT_B_WARMUP = {
  movements: [
    { name: 'Marche sur place avec bras actifs', nameEn: 'March in Place with Active Arms', duration: 60 },
    { name: 'Cercles de hanches debout', nameEn: 'Standing Hip Circles', duration: 30 },
    { name: 'Squats lents d\'activation x8', nameEn: 'Slow Activation Squats x8', duration: 45 },
    { name: 'Rotations d\'epaules avant et arriere', nameEn: 'Shoulder Circles Forward & Back', duration: 30 },
    { name: 'Respiration diaphragmatique', nameEn: 'Diaphragmatic Breathing', duration: 15 },
  ],
  totalDuration: 180,
}

const FORMAT_B_COOLDOWN = {
  movements: [
    { name: 'Etirement quadriceps debout (chaque jambe)', nameEn: 'Standing Quad Stretch (each leg)', duration: 30 },
    { name: 'Etirement des mollets contre un mur (chaque jambe)', nameEn: 'Wall Calf Stretch (each leg)', duration: 30 },
    { name: 'Etirement pectoraux en porte', nameEn: 'Doorway Chest Stretch', duration: 30 },
    { name: 'Rotation cervicale lente', nameEn: 'Slow Neck Rotation', duration: 15 },
    { name: 'Respiration 4-7-8 x 3 cycles', nameEn: '4-7-8 Breathing x 3 cycles', duration: 57 },
  ],
  totalDuration: 162,
}

// ─── Format C Warmup & Cooldown ────────────────────────────────

const FORMAT_C_WARMUP = {
  movements: [
    { name: 'Marche normale d\'echauffement', nameEn: 'Normal Walking Warmup', duration: 60 },
    { name: 'Rotations d\'epaules en marchant', nameEn: 'Shoulder Rotations While Walking', duration: 30 },
    { name: 'Marche avec montees de genoux lentes', nameEn: 'Walking with Slow High Knees', duration: 30 },
  ],
  totalDuration: 120,
}

const FORMAT_C_COOLDOWN = {
  movements: [
    { name: 'Marche normale de retour au calme', nameEn: 'Normal Walking Cooldown', duration: 60 },
    { name: 'Etirement des mollets en marchant', nameEn: 'Walking Calf Stretches', duration: 30 },
    { name: 'Respiration profonde en marchant', nameEn: 'Deep Breathing While Walking', duration: 30 },
  ],
  totalDuration: 120,
}

// ─── Session Builders ──────────────────────────────────────────

/** Format A session: 10 min, 4 blocks of 2 min (8 rounds each) */
const formatASession = (
  id: string, week: number, order: number,
  title: string, titleEn: string,
  description: string, descriptionEn: string,
  focus: string[], focusEn: string[],
  b1Odd: TabataExercise, b1Even: TabataExercise,
  b2Odd: TabataExercise, b2Even: TabataExercise,
  b3Odd: TabataExercise, b3Even: TabataExercise,
  b4Odd: TabataExercise, b4Even: TabataExercise,
  calories: number,
): TabataSession => ({
  id, week, order, title, titleEn, description, descriptionEn, focus, focusEn,
  warmup: FORMAT_A_WARMUP,
  blocks: [
    block(`${id}-b1`, b1Odd, b1Even),
    block(`${id}-b2`, b2Odd, b2Even),
    block(`${id}-b3`, b3Odd, b3Even),
    block(`${id}-b4`, b4Odd, b4Even),
  ],
  cooldown: FORMAT_A_COOLDOWN,
  equipment: ['Chaise', 'Mur (optionnel)', 'Bureau stable'],
  totalRounds: 32,
  totalDuration: 10,
  calories,
})

/** Format B session: 20 min, 5 blocks of 4 min (8 rounds each) */
const formatBSession = (
  id: string, week: number, order: number,
  title: string, titleEn: string,
  description: string, descriptionEn: string,
  focus: string[], focusEn: string[],
  b1Odd: TabataExercise, b1Even: TabataExercise,
  b2Odd: TabataExercise, b2Even: TabataExercise,
  b3Odd: TabataExercise, b3Even: TabataExercise,
  b4Odd: TabataExercise, b4Even: TabataExercise,
  b5Odd: TabataExercise, b5Even: TabataExercise,
  calories: number,
): TabataSession => ({
  id, week, order, title, titleEn, description, descriptionEn, focus, focusEn,
  warmup: FORMAT_B_WARMUP,
  blocks: [
    block(`${id}-b1`, b1Odd, b1Even),
    block(`${id}-b2`, b2Odd, b2Even),
    block(`${id}-b3`, b3Odd, b3Even),
    block(`${id}-b4`, b4Odd, b4Even),
    block(`${id}-b5`, b5Odd, b5Even),
  ],
  cooldown: FORMAT_B_COOLDOWN,
  equipment: ['Bureau stable', 'Mur (optionnel)'],
  totalRounds: 40,
  totalDuration: 20,
  calories,
})

/** Format C session: 20 min walking meeting, 5 blocks of 4 min */
const formatCSession = (
  id: string, week: number, order: number,
  title: string, titleEn: string,
  description: string, descriptionEn: string,
  focus: string[], focusEn: string[],
  calories: number,
): TabataSession => ({
  id, week, order, title, titleEn, description, descriptionEn, focus, focusEn,
  warmup: FORMAT_C_WARMUP,
  blocks: [
    block(`${id}-b1`, MARCHE_RAPIDE, MARCHE_NORMALE),
    block(`${id}-b2`, MARCHE_GENOUX_HAUTS, MARCHE_NORMALE),
    block(`${id}-b3`, MARCHE_FENTE, MARCHE_RAPIDE),
    block(`${id}-b4`, MONTEE_ESCALIERS, MARCHE_NORMALE),
    block(`${id}-b5`, MARCHE_RAPIDE, MARCHE_NORMALE),
  ],
  cooldown: FORMAT_C_COOLDOWN,
  equipment: [],
  totalRounds: 40,
  totalDuration: 20,
  calories,
})

// ─── Week 1: Creer l'habitude (3x Format A) ───────────────────

const week1: TabataWeek = {
  weekNumber: 1,
  title: 'Creer l\'habitude de la pause active',
  titleEn: 'Building the Active Break Habit',
  description: '3 seances Format A (10 min chacune). Mouvement assis et debout, parfaitement discret au bureau. Aucun equipement necessaire.',
  descriptionEn: '3 Format A sessions (10 min each). Seated and standing movement, perfectly discreet at the office. No equipment needed.',
  focus: 'Integration du mouvement dans la journee de travail',
  focusEn: 'Integrating movement into the workday',
  isDeload: false,
  sessions: [
    // W1-S1 — Format A: Activation profonde + membres inferieurs
    formatASession(
      'bur-w1-s1', 1, 1,
      'Pause active assise', 'Seated Active Break',
      'Activation profonde (assis) et membres inferieurs assis. Parfaitement discret.',
      'Deep activation (seated) and seated lower body. Perfectly discreet.',
      ['Transverse', 'Quadriceps', 'Mollets'],
      ['Transverse Abdominis', 'Quadriceps', 'Calves'],
      CONTRACTION_ABDO_ISO, SERRAGE_FESSIER,
      EXTENSION_JAMBE_ASSIS, ELEVATION_TALONS_ASSIS,
      WALL_SIT, ELEVATION_TALONS_DEBOUT,
      POMPES_BUREAU, PULL_APART,
      35,
    ),
    // W1-S2 — Format A: Renforcement jambes + haut du corps
    formatASession(
      'bur-w1-s2', 1, 2,
      'Renforcement bureau', 'Desk Strength',
      'Extension de jambes, wall sit et pompes bureau. Seance equilibree pour toute la journee.',
      'Leg extensions, wall sits and desk push-ups. Balanced session for the whole day.',
      ['Quadriceps', 'Fessiers', 'Pectoraux'],
      ['Quadriceps', 'Glutes', 'Chest'],
      SERRAGE_FESSIER, CONTRACTION_ABDO_ISO,
      ELEVATION_TALONS_ASSIS, EXTENSION_JAMBE_ASSIS,
      ELEVATION_TALONS_DEBOUT, WALL_SIT,
      PULL_APART, POMPES_BUREAU,
      38,
    ),
    // W1-S3 — Format A: Variante equilibree
    formatASession(
      'bur-w1-s3', 1, 3,
      'Equilibre bureau', 'Desk Balance',
      'Melange des exercices de la semaine pour consolider les mouvements.',
      'Mix of the week\'s exercises to consolidate movements.',
      ['Gainage', 'Mollets', 'Dos'],
      ['Core', 'Calves', 'Back'],
      CONTRACTION_ABDO_ISO, SERRAGE_FESSIER,
      EXTENSION_JAMBE_ASSIS, ELEVATION_TALONS_ASSIS,
      WALL_SIT, ELEVATION_TALONS_DEBOUT,
      PULL_APART, POMPES_BUREAU,
      36,
    ),
  ],
}

// ─── Week 2: Introduction du format long (2x A + 1x B) ────────

const week2: TabataWeek = {
  weekNumber: 2,
  title: 'Introduction du format long',
  titleEn: 'Introducing the Longer Format',
  description: '2 seances Format A (10 min) + 1 seance Format B (20 min). Le Format B introduit des exercices debout plus intenses.',
  descriptionEn: '2 Format A sessions (10 min) + 1 Format B session (20 min). Format B introduces more intense standing exercises.',
  focus: 'Progression vers le format 20 minutes, exercices debout',
  focusEn: 'Progressing to the 20-minute format, standing exercises',
  isDeload: false,
  sessions: [
    // W2-S1 — Format A (assis)
    formatASession(
      'bur-w2-s1', 2, 1,
      'Pause rapide assise', 'Quick Seated Break',
      'Format A renforce. Les contractions isometriques deviennent plus naturelles.',
      'Consolidated Format A. Isometric contractions become more natural.',
      ['Transverse', 'Quadriceps', 'Epaules'],
      ['Transverse Abdominis', 'Quadriceps', 'Shoulders'],
      CONTRACTION_ABDO_ISO, SERRAGE_FESSIER,
      EXTENSION_JAMBE_ASSIS, ELEVATION_TALONS_ASSIS,
      WALL_SIT, ELEVATION_TALONS_DEBOUT,
      POMPES_BUREAU, PULL_APART,
      37,
    ),
    // W2-S2 — Format A (variant)
    formatASession(
      'bur-w2-s2', 2, 2,
      'Renforcement silencieux', 'Silent Strengthening',
      'Derniere seance Format A de la semaine. Focus sur la qualite des contractions.',
      'Last Format A session of the week. Focus on contraction quality.',
      ['Fessiers', 'Pectoraux', 'Mollets'],
      ['Glutes', 'Chest', 'Calves'],
      SERRAGE_FESSIER, CONTRACTION_ABDO_ISO,
      ELEVATION_TALONS_ASSIS, EXTENSION_JAMBE_ASSIS,
      ELEVATION_TALONS_DEBOUT, WALL_SIT,
      PULL_APART, POMPES_BUREAU,
      38,
    ),
    // W2-S3 — Format B (20 min debout)
    formatBSession(
      'bur-w2-s3', 2, 3,
      'Format long debout', 'Long Standing Session',
      'Premiere seance Format B. 20 minutes debout avec squats silencieux, fentes et dips bureau.',
      'First Format B session. 20 minutes standing with silent squats, lunges and desk dips.',
      ['Quadriceps', 'Triceps', 'Proprioception', 'Obliques'],
      ['Quadriceps', 'Triceps', 'Proprioception', 'Obliques'],
      SQUAT_SILENCIEUX, FENTE_STATIQUE_ROTATION,
      BUREAU_DIPS, CALF_RAISES_FERMES,
      ISOMETRIE_FESSIERS_DEBOUT, ROTATION_BUSTE_RAPIDE,
      SQUAT_SILENCIEUX, ELEVATION_TALONS_DEBOUT,
      ROTATION_BUSTE_RAPIDE, ISOMETRIE_FESSIERS_DEBOUT,
      90,
    ),
  ],
}

// ─── Week 3: Walking meeting integre (1x A + 2x B + 1x C) ────

const week3: TabataWeek = {
  weekNumber: 3,
  title: 'Walking meeting integre',
  titleEn: 'Walking Meeting Integrated',
  description: '1 Format A + 2 Format B + 1 Format C (walking meeting audio). Seule semaine a 4 seances.',
  descriptionEn: '1 Format A + 2 Format B + 1 Format C (audio walking meeting). Only week with 4 sessions.',
  focus: 'Introduction de la marche active, autonomie dans les formats',
  focusEn: 'Introducing active walking, autonomy across formats',
  isDeload: false,
  sessions: [
    // W3-S1 — Format A (rappel)
    formatASession(
      'bur-w3-s1', 3, 1,
      'Pause express bureau', 'Express Desk Break',
      'Dernier Format A du programme. Tous les exercices doivent etre fluides.',
      'Last Format A of the program. All exercises should feel fluid.',
      ['Transverse', 'Quadriceps', 'Haut du corps'],
      ['Transverse Abdominis', 'Quadriceps', 'Upper Body'],
      CONTRACTION_ABDO_ISO, SERRAGE_FESSIER,
      EXTENSION_JAMBE_ASSIS, ELEVATION_TALONS_ASSIS,
      WALL_SIT, ELEVATION_TALONS_DEBOUT,
      POMPES_BUREAU, PULL_APART,
      38,
    ),
    // W3-S2 — Format B (renforcement)
    formatBSession(
      'bur-w3-s2', 3, 2,
      'Renforcement standing', 'Standing Strength',
      'Format B renforce. Squats silencieux, fentes avec rotation et proprioception.',
      'Consolidated Format B. Silent squats, lunges with rotation and proprioception.',
      ['Quadriceps', 'Triceps', 'Mobilite thoracique', 'Equilibre'],
      ['Quadriceps', 'Triceps', 'Thoracic Mobility', 'Balance'],
      SQUAT_SILENCIEUX, FENTE_STATIQUE_ROTATION,
      BUREAU_DIPS, CALF_RAISES_FERMES,
      ISOMETRIE_FESSIERS_DEBOUT, ROTATION_BUSTE_RAPIDE,
      WALL_SIT, SQUAT_SILENCIEUX,
      PULL_APART, ROTATION_BUSTE_RAPIDE,
      92,
    ),
    // W3-S3 — Format B (intensite)
    formatBSession(
      'bur-w3-s3', 3, 3,
      'Intensite bureau avancee', 'Advanced Desk Intensity',
      'Format B intense. Plus de proprioception et de mobilite thoracique.',
      'Intense Format B. More proprioception and thoracic mobility.',
      ['Fessiers', 'Obliques', 'Proprioception', 'Dos'],
      ['Glutes', 'Obliques', 'Proprioception', 'Back'],
      FENTE_STATIQUE_ROTATION, SQUAT_SILENCIEUX,
      CALF_RAISES_FERMES, BUREAU_DIPS,
      ROTATION_BUSTE_RAPIDE, ISOMETRIE_FESSIERS_DEBOUT,
      ELEVATION_TALONS_DEBOUT, WALL_SIT,
      ISOMETRIE_FESSIERS_DEBOUT, ROTATION_BUSTE_RAPIDE,
      95,
    ),
    // W3-S4 — Format C (walking meeting)
    formatCSession(
      'bur-w3-s4', 3, 4,
      'Walking meeting actif', 'Active Walking Meeting',
      'Seance audio guidee pendant une marche. Marche rapide, genoux hauts, marche en fente et escaliers.',
      'Audio-guided session during a walk. Brisk walking, high knees, lunge walking and stairs.',
      ['Cardio', 'Membres inferieurs', 'Endurance'],
      ['Cardio', 'Lower Body', 'Endurance'],
      85,
    ),
  ],
}

// ─── Week 4: Autonomie — Decharge (3x mixed formats) ──────────

const week4: TabataWeek = {
  weekNumber: 4,
  title: 'Autonomie — Semaine de decharge',
  titleEn: 'Autonomy — Deload Week',
  description: 'Semaine 4 = decharge + prise d\'autonomie. Choisir selon la journee. L\'objectif : integrer le mouvement comme reflexe.',
  descriptionEn: 'Week 4 = deload + building autonomy. Choose based on your day. Goal: make movement a reflex.',
  focus: 'Autonomie, choix du format selon la journee, consolidation',
  focusEn: 'Autonomy, choosing format based on the day, consolidation',
  isDeload: true,
  sessions: [
    // W4-S1 — Format A (deload)
    formatASession(
      'bur-w4-s1', 4, 1,
      'Micro-pause autonome', 'Autonomous Micro-break',
      'Format A en autonomie. 10 minutes pour relancer la concentration.',
      'Autonomous Format A. 10 minutes to boost concentration.',
      ['Transverse', 'Fessiers', 'Epaules'],
      ['Transverse Abdominis', 'Glutes', 'Shoulders'],
      CONTRACTION_ABDO_ISO, SERRAGE_FESSIER,
      EXTENSION_JAMBE_ASSIS, ELEVATION_TALONS_ASSIS,
      WALL_SIT, ELEVATION_TALONS_DEBOUT,
      PULL_APART, POMPES_BUREAU,
      32,
    ),
    // W4-S2 — Format B (deload)
    formatBSession(
      'bur-w4-s2', 4, 2,
      'Pause longue autonome', 'Autonomous Long Break',
      'Format B en autonomie. Mouvements debout avec proprioception et mobilite.',
      'Autonomous Format B. Standing movements with proprioception and mobility.',
      ['Quadriceps', 'Equilibre', 'Mobilite thoracique'],
      ['Quadriceps', 'Balance', 'Thoracic Mobility'],
      SQUAT_SILENCIEUX, ELEVATION_TALONS_DEBOUT,
      FENTE_STATIQUE_ROTATION, ISOMETRIE_FESSIERS_DEBOUT,
      PULL_APART, ROTATION_BUSTE_RAPIDE,
      WALL_SIT, CALF_RAISES_FERMES,
      BUREAU_DIPS, PULL_APART,
      80,
    ),
    // W4-S3 — Format C (walking meeting deload)
    formatCSession(
      'bur-w4-s3', 4, 3,
      'Marche active autonome', 'Autonomous Active Walk',
      'Walking meeting en autonomie. Le mouvement est devenu un reflexe.',
      'Autonomous walking meeting. Movement has become a reflex.',
      ['Cardio', 'Endurance', 'Bien-etre'],
      ['Cardio', 'Endurance', 'Wellbeing'],
      75,
    ),
  ],
}

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

export const BUREAU_PROGRAM: TabataProgram = {
  id: 'bureau',
  title: 'Programme Bureau',
  titleEn: 'Office Program',
  description: 'Integrer le mouvement comme reflexe dans la journee de travail. 10 minutes de mouvement actif reduisent les douleurs lombaires de 30% et ameliorent la concentration de 20%.',
  descriptionEn: 'Make movement a reflex in your workday. 10 minutes of active movement reduces lower back pain by 30% and improves concentration by 20%.',
  tier: 'premium',
  accentColor: '#FFD60A',
  icon: 'briefcase',
  durationWeeks: 4,
  sessionsPerWeek: 4, // Variable: 3 in W1/W2/W4, 4 in W3
  totalSessions: 13,
  equipment: {
    required: [],
    optional: ['Chaise', 'Bureau stable', 'Mur'],
  },
  focusAreas: ['Wall sit', 'Gainage assis', 'Pompes bureau', 'Extension jambe assise', 'Proprioception'],
  focusAreasEn: ['Wall sit', 'Seated core', 'Desk push-ups', 'Seated leg extension', 'Proprioception'],
  principles: [
    'Silence : pas de sauts, pas d\'impacts, pas de chutes au sol',
    'Pas de sol : exercices debout ou assis sur une chaise uniquement',
    'Pas de sueur visible : intensite calibree pour le bureau',
    '10 ou 20 min max selon le format',
    'Tenue de bureau : aucun equipement sportif necessaire',
  ],
  principlesEn: [
    'Silent: no jumps, no impact, no floor work',
    'No floor: standing or seated on a chair only',
    'No visible sweat: intensity calibrated for the office',
    '10 or 20 min max depending on format',
    'Office attire: no sports equipment needed',
  ],
  completionCriteria: [
    'Realiser un Format B complet sans pause supplementaire',
    'Tenir un wall sit 90 secondes sans douleur',
    'Integrer au moins 3 pauses actives par semaine de travail',
    'Connaitre les exercices par cœur (sans regarder l\'ecran)',
  ],
  completionCriteriaEn: [
    'Complete a full Format B without extra breaks',
    'Hold a wall sit for 90 seconds without pain',
    'Integrate at least 3 active breaks per work week',
    'Know the exercises by heart (without looking at the screen)',
  ],
  nextProgramId: 'debutant',
  weeks: [week1, week2, week3, week4],
}

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