/*
 * File: auth.ts
 * Description: Authentication and user-related type definitions
 * Design & Developed by Tech4Biz Solutions
 * Copyright (c) Spurrin Innovations. All rights reserved.
 */

export interface NotificationPreferences {
  critical_alerts: {
    email: boolean;
    in_app: boolean;
    push: boolean;
    sms: boolean;
  };
  system_notifications: {
    push: boolean;
    email: boolean;
    in_app: boolean;
  };
}

export interface DashboardSettings {
  theme: string;
  language: string;
  timezone: string;
}

export interface User {
  user_id: string;
  email: string;
  first_name: string;
  last_name: string;
  display_name: string;
  hospital_id: string;
  dashboard_role: string;
  profile_photo_url: string | null;
  theme_color: string | null;
  accent_color: string | null;
  notification_preferences: NotificationPreferences;
  dashboard_settings: DashboardSettings;
  onboarded: boolean;
  onboarding_completed: boolean;
  onboarding_step: number;
  onboarding_message: string;
  access_token: string;
  platform: 'app'|'web';
  self_url:string | null;
}

export type UserRole = 
  | 'ER_PHYSICIAN'
  | 'RESIDENT'
  | 'MEDICAL_STUDENT'
  | 'EMERGENCY_ACCESS'
  | 'TEMPORARY_ACCESS';

export interface AuthState {
  user: User | null;
  isAuthenticated: boolean;
  isLoading: boolean;
  error: string | null;
  sessionExpiry: Date | null;
  deviceId: string | null;
}

export interface LoginCredentials {
  email: string;
  password: string;
  rememberDevice?: boolean;
}

export interface SSOLoginData {
  token: string;
  hospitalId: string;
  redirectUrl?: string;
}

export interface EmergencyAccess {
  accessCode: string;
  reason: string;
  duration: number; // minutes
}

export interface SessionData {
  token: string;
  refreshToken: string;
  expiresAt: Date;
  deviceId: string;
}

/*
 * End of File: auth.ts
 * Design & Developed by Tech4Biz Solutions
 * Copyright (c) Spurrin Innovations. All rights reserved.
 */ 