import type { CountryCode } from '@/types/commonTypes';
import type { TFunction } from 'i18next';
import type { Dispatch } from 'react';

export enum Gender {
  Male = 2,
  Female = 1,
  None = 0,
}

export interface InfoRowData {
  firstName: string;
  lastName: string;
  nationalCode: string;
  country: string | '';
  gender: Gender;
}

export interface Device {
  id: string;
  timeAndDate: string;
  deviceModel: string;
  ip: string;
  current: boolean;
}

export interface PasswordDialogProps {
  open: boolean;
  fullScreen: boolean;
  handleClose: () => void;
  password: string;
  setPassword: (val: string) => void;
  confirmPassword: string;
  setConfirmPassword: (val: string) => void;
  currentPassword: string;
  setCurrentPassword: (val: string) => void;
  showValidation: boolean;
  validPassword: boolean;
  matchPassword: boolean;
  loading: boolean;
  handleSubmit: () => void;
  changePassword: boolean;
  hasMinLength: boolean;
  hasNumber: boolean;
  hasUpperAndLower: boolean;
  hasSpecialChar: boolean;
}

export interface ValidationItemProps {
  isValid: boolean;
  label: string;
}

export interface SocialMediaDialogProps {
  open: boolean;
  onClose: () => void;
  t: (key: string) => string;
  emailInput: string;
  setEmailInput: (val: string) => void;
  fullScreen: boolean;
  computedMaxWidth: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
  verificationCode: string;
  setVerificationCode: (value: string) => void;
  apiError: string | null;
  isLoading: boolean;
  dialogStep: 'enterEmail' | 'enterCode';
  onSendCode: () => void;
  onConfirmEmail: () => void;
}

export interface SocialMediaListProps {
  t: (key: string) => string;
  emailList: readonly {
    email: string;
    provider: 'email' | 'google' | 'apple';
    time: string;
  }[];
}

export interface SocialMediaMenuProps {
  t: (key: string) => string;
  onOpenDialog: () => void;
}

export interface Phone {
  phone: string;
  time: string;
  withCode: string;
}

export interface EmailAccount {
  email: string;
  provider: 'email' | 'google';
  time: string;
}

export interface PhoneActionButtonsProps {
  isEditing: boolean;
  toggleEdit: () => void;
  t: TFunction<'setting'>;
  formId?: string;
  isSubmitting?: boolean;
}

export interface PhoneDisplayProps {
  phones: { phone: string; time: string }[];
}

export interface PhoneEditFormProps {
  phoneNumber: string;
  setPhoneNumber: (v: string) => void;
  countryCode: CountryCode;
  setCountryCode: (v: CountryCode) => void;
  verificationCode: string;
  setVerificationCode: (v: string) => void;
  isVerified: boolean;
  isVerifying: boolean;
  isSendingCode: boolean;
  isCodeSent: boolean;
  setIsCodeSent: Dispatch<boolean>;
  buttonState: 'default' | 'counting';
  setButtonState: (v: 'default' | 'counting') => void;
  handleSendCode: () => void;
  handleVerifyClick: () => void;
  phoneNumberError?: string;
  verificationCodeError?: string;
  handleBlur: (key: string) => void;
  phones: { phone: string; time: string; withCode: string }[];
}

export interface DisplayFieldProps {
  label: string;
  value: string;
}

export interface InfoRowDisplayProps {
  data: InfoRowData;
  uploadedImageUrl: string | null;
  initials: string;
}

export interface InfoRowEditProps {
  data: InfoRowData;
  setData: React.Dispatch<React.SetStateAction<InfoRowData>>;
}

export interface ProfileImageProps {
  initials: string;
  uploadedImageUrl: string | null;
  onImageChange: (file: File) => void;
  onRemoveImage?: () => void;
}
