export enum UserRole {
  USER = 'USER',
  SUPPORT = 'SUPPORT',
  MODERATOR = 'MODERATOR',
  ADMIN = 'ADMIN',
  SUPER_ADMIN = 'SUPER_ADMIN',
}

export interface AuthenticatedUser {
  id: string;
  email: string;
  username: string;
  displayName: string | null;
  emailVerified: boolean;
  roles: UserRole[];
}

export interface SessionContext {
  user: AuthenticatedUser;
  sessionId: string;
  issuedAt: Date;
  expiresAt: Date;
}

export interface AuthTokenPayload {
  sub: string;
  sessionId: string;
  roles: UserRole[];
  iat?: number;
  exp?: number;
}

export { hashPassword, verifyPassword } from './password';
export {
  generateSecureToken,
  hashToken,
  verifyTokenHash,
} from './tokens';
export {
  generateUsernameFromEmail,
  sanitizeUsername,
  validateUsername,
  MIN_USERNAME_LENGTH,
  MAX_USERNAME_LENGTH,
  type UsernameValidationResult,
} from './username';
export {
  generateTotpSecret,
  verifyTotpCode,
  buildOtpAuthUrl,
} from './totp';
export {
  generateRecoveryCodes,
  hashRecoveryCode,
  verifyRecoveryCode,
} from './recovery-codes';
export {
  SESSION_COOKIE_NAME,
  SESSION_DURATION_MS,
  SESSION_ABSOLUTE_MAX_DURATION_MS,
  SESSION_REMEMBER_ME_DURATION_MS,
  createSessionExpiry,
} from './session';
