export type MuscleGroup =
  | 'brust'
  | 'ruecken'
  | 'schultern'
  | 'bizeps'
  | 'trizeps'
  | 'beine'
  | 'bauch'
  | 'ganzkoerper'
  | 'sonstiges';

export const MUSCLE_GROUPS: { value: MuscleGroup; label: string }[] = [
  { value: 'brust', label: 'Brust' },
  { value: 'ruecken', label: 'Rücken' },
  { value: 'schultern', label: 'Schultern' },
  { value: 'bizeps', label: 'Bizeps' },
  { value: 'trizeps', label: 'Trizeps' },
  { value: 'beine', label: 'Beine' },
  { value: 'bauch', label: 'Bauch' },
  { value: 'ganzkoerper', label: 'Ganzkörper' },
  { value: 'sonstiges', label: 'Sonstiges' },
];

export const MUSCLE_GROUP_LABELS: Record<MuscleGroup, string> = {
  brust: 'Brust',
  ruecken: 'Rücken',
  schultern: 'Schultern',
  bizeps: 'Bizeps',
  trizeps: 'Trizeps',
  beine: 'Beine',
  bauch: 'Bauch',
  ganzkoerper: 'Ganzkörper',
  sonstiges: 'Sonstiges',
};

export const MUSCLE_GROUP_COLORS: Record<MuscleGroup, string> = {
  brust: 'bg-red-600',
  ruecken: 'bg-blue-600',
  schultern: 'bg-yellow-600',
  bizeps: 'bg-purple-600',
  trizeps: 'bg-pink-600',
  beine: 'bg-green-600',
  bauch: 'bg-orange-600',
  ganzkoerper: 'bg-teal-600',
  sonstiges: 'bg-gray-600',
};

export interface Exercise {
  id: number;
  name: string;
  description: string;
  muscle_group: MuscleGroup;
  weight_step_kg: number;
  created_at: string;
  updated_at: string;
  deleted_at?: string;
}

export interface TrainingSet {
  id: number;
  name: string;
  exercises: Exercise[];
  created_at: string;
  deleted_at?: string;
}

export interface SessionLog {
  id: number;
  session_id: number;
  exercise_id: number;
  exercise_name: string;
  set_number: number;
  weight_kg: number;
  reps: number;
  note: string;
  logged_at: string;
}

export interface Session {
  id: number;
  set_id: number;
  set_name: string;
  started_at: string;
  ended_at?: string;
  note: string;
  logs?: SessionLog[];
}

export interface LastLogResponse {
  weight_kg: number;
  reps: number;
}

export interface ExerciseStats {
  exercise_id: number;
  exercise_name: string;
  max_weight_kg: number;
  total_volume_kg: number;
  total_sets: number;
  last_trained: string;
}

export interface CreateExerciseRequest {
  name: string;
  description: string;
  muscle_group: MuscleGroup;
  weight_step_kg?: number;
}

export interface CreateSetRequest {
  name: string;
  exercise_ids: number[];
}

export interface UpdateSetRequest {
  name: string;
  exercise_ids: number[];
}

export interface CreateSessionRequest {
  set_id: number;
}

export interface CreateLogRequest {
  exercise_id: number;
  set_number: number;
  weight_kg: number;
  reps: number;
  note: string;
}

export interface UpdateLogRequest {
  weight_kg?: number;
  reps?: number;
  note?: string;
}
