/**
 * Onboarding API Types - Mirror backend schemas
 */

export interface OnboardingStepStatus {
  step_name: string;
  completed: boolean;
  completed_at?: string;
  data?: Record<string, any>;
}

/**
 * Wizard context state extracted from backend step data.
 * Used to restore frontend WizardContext on session restore.
 */
export interface WizardContextState {
  bakery_type: string | null;
  tenant_id: string | null;
  subscription_tier: string | null;
  ai_analysis_complete: boolean;
  inventory_review_completed: boolean;
  stock_entry_completed: boolean;
  categorization_completed: boolean;
  suppliers_completed: boolean;
  inventory_setup_completed: boolean;
  recipes_completed: boolean;
  quality_completed: boolean;
  team_completed: boolean;
  child_tenants_completed: boolean;
  ml_training_complete: boolean;
}

export interface UserProgress {
  user_id: string;
  steps: OnboardingStepStatus[];
  current_step: string;
  next_step?: string;
  completion_percentage: number;
  fully_completed: boolean;
  last_updated: string;
  context_state?: WizardContextState;
}

export interface UpdateStepRequest {
  step_name: string;
  completed: boolean;
  data?: Record<string, any>;
}

export interface SaveStepDraftRequest {
  step_name: string;
  draft_data: Record<string, any>;
}

export interface StepDraftResponse {
  step_name: string;
  draft_data: Record<string, any> | null;
  draft_saved_at?: string;
  demo_mode?: boolean;
}