export interface SessionResponse {
  success: boolean
  data: AuthUser
  active_role: AuthRole | null
  can_switch_role: boolean
  redirect_path: string
}

export interface LoginCredentials {
  email: string
  password: string
  remember?: boolean
}

export interface AuthRole {
  id: string
  name: string
  fullname: string | null
  guard_name: string
  context: string
}

export interface AuthPermission {
  id: string
  name: string
  guard_name: string
  route_name: string | null
}

export interface AuthUser {
  id: string
  name: string
  email: string
  ic_number: string | null
  position: string | null
  phone_number: string | null
  phone_verified_at: string | null
  image_url: string | null
  member_number: number | null
  member_type: string | null
  public_profile_token: string | null
  status: string
  gender: string | null
  marriage_status: string | null
  join_date: string | null
  birth_date: string | null
  birth_place: string | null
  onboarding_completed_at: string | null
  email_verified_at: string | null
  roles?: Array<AuthRole & { permissions?: AuthPermission[] }>
}

export interface LoginSessionData {
  user: AuthUser
  token_type: string
  expires_at: string
}

export interface AuthSessionResponse {
  success: boolean
  message: string
  data: LoginSessionData
  active_role?: AuthRole | null
  can_switch_role?: boolean
  redirect_path?: string
}

export type LoginResponse = AuthSessionResponse

export interface SwitchRoleResponse extends SessionResponse {
  message: string
}

export interface RegisterCredentials {
  name: string
  email: string
  ic_number: string
  phone_number: string
  phone_verification_token: string
  password: string
  password_confirmation: string
}

export type RegisterResponse = AuthSessionResponse

export interface SendPhoneVerificationOtpPayload {
  phone_number: string
}

export interface SendPhoneVerificationOtpResponse {
  success: boolean
  message: string
}

export interface VerifyPhoneVerificationOtpPayload {
  phone_number: string
  otp: string
}

export interface VerifyPhoneVerificationOtpResponse {
  success: boolean
  message: string
  data: {
    phone_number: string
    verification_token: string
  }
}

export interface VerifyAuthenticatedPhoneVerificationOtpResponse {
  success: boolean
  message: string
  data: AuthUser
}

export interface ResendVerificationResponse {
  success: boolean
  message: string
}

export interface ForgotPasswordPayload {
  email: string
}

export interface ForgotPasswordResponse {
  success: boolean
  message: string
}

export interface ResetPasswordPayload {
  email: string
  otp: string
  password: string
  password_confirmation: string
}

export interface ResetPasswordResponse {
  success: boolean
  message: string
}
