/**
 * Sync Types for Supabase Integration
 * Handles opt-in personalization for premium users
 */

export type SyncStatus =
  | 'never-synced' // Never been asked or opted in
  | 'prompt-pending' // Waiting to show prompt (after first workout)
  | 'synced' // Currently syncing
  | 'unsynced' // Previously synced, now disabled

export interface UserProfileData {
  name: string
  fitnessLevel: string
  goal: string
  weeklyFrequency: number
  barriers: string[]
  onboardingCompletedAt: string
}

export interface WorkoutSessionData {
  workoutId: string
  completedAt: string
  durationSeconds: number
  caloriesBurned: number
  feelingRating?: number
}

export interface UserPreferencesData {
  preferredCategories: string[]
  preferredTrainers: string[]
  preferredDurations: number[]
  difficultyPreference: 'easier' | 'matched' | 'harder'
}

export interface SyncState {
  status: SyncStatus
  userId: string | null
  lastSyncAt: string | null
  pendingWorkouts: number // Local workouts waiting to sync
}

export interface EnableSyncResult {
  success: boolean
  userId?: string
  error?: string
}

export interface SyncWorkoutResult {
  success: boolean
  error?: string
}

export interface DeleteDataResult {
  success: boolean
  error?: string
}
