import { OnboardingProfileDb } from './database'; export type PersistentOnboardingStep = 'lexicon' | 'customize'; export const OnboardingProgressService = { isStepCompleted(userId: number, step: PersistentOnboardingStep): boolean { const profile = OnboardingProfileDb.get(userId); return step === 'lexicon' ? profile.lexicon_explored === 1 : profile.customization_done === 1; }, completeStep(userId: number, step: PersistentOnboardingStep): void { if (step === 'lexicon') { OnboardingProfileDb.setLexiconExplored(userId, true); return; } OnboardingProfileDb.setCustomizationDone(userId, true); }, getSignals(userId: number) { const profile = OnboardingProfileDb.get(userId); return { lexiconExplored: profile.lexicon_explored === 1, customizationDone: profile.customization_done === 1, }; }, getAcquisitionSource(userId: number): string | null { return OnboardingProfileDb.get(userId).acquisition_source; }, setAcquisitionSource(userId: number, source: string): void { OnboardingProfileDb.setAcquisitionSource(userId, source); }, setPrimaryGoal(userId: number, goal: string): void { OnboardingProfileDb.setPrimaryGoal(userId, goal); }, setExperienceLevel(userId: number, level: string): void { OnboardingProfileDb.setExperienceLevel(userId, level); }, };