/**
 * TabataFit Access Control Service
 * Manages free tier vs premium workout access
 *
 * Freemium model: 3 free workouts, rest behind paywall
 */

/** Workout IDs available without a subscription */
export const FREE_WORKOUT_IDS: readonly string[] = [
  '1',   // Full Body Ignite — Beginner, 4 min (full-body)
  '11',  // Core Crusher — Intermediate, 4 min (core)
  '43',  // Dance Cardio — Beginner, 4 min (cardio)
] as const

/** Number of free workouts (for display in paywall copy) */
export const FREE_WORKOUT_COUNT = FREE_WORKOUT_IDS.length

/**
 * Check if a specific workout is part of the free tier
 */
export function isFreeWorkout(workoutId: string): boolean {
  return FREE_WORKOUT_IDS.includes(workoutId)
}

/**
 * Check if user can access a workout
 * Premium users can access everything; free users only get FREE_WORKOUT_IDS
 */
export function canAccessWorkout(workoutId: string, isPremium: boolean): boolean {
  if (isPremium) return true
  return isFreeWorkout(workoutId)
}
