part of 'session_cubit.dart'; /// Definisce lo stato macroscopico della sessione enum SessionStatus { initial, unauthenticated, onboardingRequired, authenticated, } /// Definisce lo step esatto dell'onboarding (Paranoia Mode) enum OnboardingStep { none, // Non serve onboarding company, // Step 1: Manca l'azienda store, // Step 2: Manca il negozio staff, // Step 3: Manca il profilo staff ("Paziente Zero") completed, // Flusso terminato con successo } class SessionState extends Equatable { final SessionStatus status; final User? user; // Utente di Supabase Auth final CompanyModel? company; final StoreModel? currentStore; final StaffMemberModel? currentStaffMember; final OnboardingStep onboardingStep; final bool isMobileDevice; final bool isSingleUserMode; const SessionState({ this.status = SessionStatus.initial, this.user, this.company, this.currentStore, this.currentStaffMember, this.onboardingStep = OnboardingStep.none, this.isMobileDevice = false, this.isSingleUserMode = false, }); /// Metodo per creare una copia dello stato modificando solo i campi necessari SessionState copyWith({ SessionStatus? status, User? user, CompanyModel? company, StoreModel? currentStore, StaffMemberModel? currentStaffMember, OnboardingStep? onboardingStep, bool? isMobileDevice, bool? isSingleUserMode, }) { return SessionState( status: status ?? this.status, user: user ?? this.user, company: company ?? this.company, currentStore: currentStore ?? this.currentStore, currentStaffMember: currentStaffMember ?? this.currentStaffMember, onboardingStep: onboardingStep ?? this.onboardingStep, isMobileDevice: isMobileDevice ?? this.isMobileDevice, isSingleUserMode: isSingleUserMode ?? this.isSingleUserMode, ); } @override List get props => [ status, user, company, currentStore, currentStaffMember, onboardingStep, isMobileDevice, isSingleUserMode, ]; // Helper rapidi per la UI bool get isAuthenticated => status == SessionStatus.authenticated; bool get needsOnboarding => status == SessionStatus.onboardingRequired; }