export interface AuthUser {
  id: string;
  email: string;
  username: string;
  phoneNumber: string;
  name: {
    am: string;
    en: string;
  };
  status: string;
  sharepointId: string | null;
  hasSetPassword: boolean;
  hasFinishedRegistration: boolean;
  hasFinishedDMSOnboarding: boolean;
  isPhoneNumberVerified: boolean;
  userType: string;
}

export interface AuthState {
  user: AuthUser | null;
  token: string | null;
  isAuthenticated: boolean;
  currentProfile: CurrentProfile | null;
}

export interface LoginPayload {
  token: string;
  refreshToken: string;
  isPhoneNumberVerified: boolean;
  /** Set (with no tokens) when the account requires an OTP second factor. */
  mfaRequired?: boolean;
}

export interface CurrentProfileAddress {
  id: string;
  idType: string;
  idNumber: string;
  passportNumber: string | null;
  passportExpiry: string | null;
  nationality: string;
  regionId: string | null;
  cityId: string | null;
  subCityId: string | null;
  woredaId: string | null;
  kebeleId: string | null;
  streetAddress: string | null;
  currentAddress: string | null;
  houseNumber: string | null;
  primaryPhoneNumber: string;
  secondaryPhoneNumber: string | null;
  email: string | null;
  website: string | null;
  postalAddress: string | null;
  emergencyContactName: string | null;
  emergencyContactPhone: string | null;
  emergencyContactRelation: string | null;
  isActive: boolean;
}

export interface CurrentProfileProfession {
  id: string;
  departmentId: string;
  name: { en: string };
  description: { en: string };
  isActive: boolean;
}

export interface CurrentProfile {
  id: string;
  userId: string;
  professionId: string;
  addressId: string;
  type: string;
  firstName: string;
  middleName: string;
  lastName: string;
  gender: string;
  dob: string;
  pob: string;
  maritalStatus: string;
  isComplete: boolean;
  /**
   * Registered-seafarer identity — written by the platform when a seafarer
   * registration is approved, null before that.
   */
  seafarerNumber?: string | null;
  /** Biometric Subject ID — stamped by staff once biometric enrollment is confirmed. */
  bsid?: string | null;
  seafarerStatus?: 'ACTIVE' | 'INACTIVE' | 'PENDING' | 'SUSPENDED' | null;
  seafarerDepartment?: 'DECK' | 'ENGINE' | 'CATERING' | null;
  seafarerStatusReason?: string | null;
  /** Identifying particulars for the Seaman Book. Left blank by choice. */
  bloodType?: string | null;
  hairColor?: string | null;
  eyeColor?: string | null;
  heightCm?: number | null;
  user: AuthUser;
  address: CurrentProfileAddress;
  profession: CurrentProfileProfession;
}

export interface CurrentProfileState {
  profile: CurrentProfile | null;
}
