import { CurrentUser } from '@/shared/types/auth';
import { CampusId, StaffProfile, UserRole } from '@/shared/types/app';

export interface AuthActionResult {
  readonly error: string | null;
}

export interface AuthSessionState {
  readonly user: CurrentUser | null;
  readonly profile: StaffProfile | null;
  readonly loading: boolean;
  readonly isAuthenticated: boolean;
  readonly signIn: (email: string, password: string) => Promise<AuthActionResult>;
  readonly signUp: (
    email: string,
    password: string,
    fullName: string,
    role: UserRole,
    campus: string,
  ) => Promise<AuthActionResult>;
  readonly signOut: () => Promise<AuthActionResult>;
  readonly updateProfile: (updates: Partial<StaffProfile>) => Promise<AuthActionResult>;
}

export type AuthModalMode = 'signin' | 'signup';

export type AuthSignupStep = 1 | 2 | 3;

export interface AuthModalDraft {
  readonly email: string;
  readonly password: string;
  readonly confirmPassword: string;
  readonly fullName: string;
  readonly role: UserRole;
  readonly campus: CampusId | '';
  readonly showPassword: boolean;
}

export interface AuthModalWorkflowInput {
  readonly signIn: AuthSessionState['signIn'];
  readonly signUp: AuthSessionState['signUp'];
  readonly onClose: () => void;
}
