/**
 * TabataFit Program Types
 * Physiotherapist-designed 3-program progressive system
 */

export type ProgramId = 'upper-body' | 'lower-body' | 'full-body'

export type WeekNumber = 1 | 2 | 3 | 4

export type ProgramWorkout = {
  id: string
  week: WeekNumber
  order: number // 1-5 within the week
  title: string
  description: string
  duration: 4 // minutes - all workouts are 4 min
  exercises: ProgramExercise[]
  equipment: string[]
  focus: string[]
  tips: string[]
}

export type ProgramExercise = {
  name: string
  duration: 20 // seconds - fixed for Tabata
  reps?: string // optional rep guidance (e.g., "8-10 reps")
  modification?: string // easier alternative
  progression?: string // harder alternative
}

export interface Week {
  weekNumber: WeekNumber
  title: string
  description: string
  focus: string
  workouts: ProgramWorkout[]
}

export interface Program {
  id: ProgramId
  title: string
  description: string
  durationWeeks: 4
  workoutsPerWeek: 5
  totalWorkouts: 20
  equipment: {
    required: string[]
    optional: string[]
  }
  focusAreas: string[]
  weeks: Week[]
}

export interface ProgramProgress {
  programId: ProgramId
  currentWeek: WeekNumber
  currentWorkoutIndex: number // 0-4 within current week
  completedWorkoutIds: string[]
  isProgramCompleted: boolean
  startDate?: string
  lastWorkoutDate?: string
}

export interface AssessmentExercise {
  name: string
  duration: 20
  purpose: string // what we're checking
}

export interface Assessment {
  id: 'initial-assessment'
  title: string
  description: string
  duration: 4
  exercises: AssessmentExercise[]
  tips: string[]
}

export interface AssessmentResult {
  completedAt: string
  exercisesCompleted: string[]
  notes?: string
  recommendedProgram?: ProgramId
}

export type UserProgramState = {
  selectedProgram: ProgramId | null
  programsProgress: Record<ProgramId, ProgramProgress>
  assessment: {
    isCompleted: boolean
    result: AssessmentResult | null
  }
}
