import { createEntityHook } from './useEntityBase';
import { ENDPOINTS } from '@/constants/endpoints';
import type { CustomerDTO } from '@/types';
import i18n from "@/lib/i18n";

export type CustomerCreateDTO = {
  user_id?: string | null;
  email?: string | null;
  phone?: string | null;
  password?: string | null;
  full_name_ar?: string | null;
  identity_type: 'national_id' | 'passport' | 'residence_id' | 'gcc_id' | 'commercial_registration' | 'tax_id';
  identity_number: string;
  identity_country_id: string;
  identity_expiry_date?: string | null;
  kyc_level?: 'basic' | 'intermediate' | 'premium';
  registered_at_branch_id?: string | null;
  primary_branch_id?: string | null;
};

export type CustomerUpdateDTO = Partial<Pick<CustomerCreateDTO, 'email' | 'phone' | 'full_name_ar' | 'kyc_level' | 'primary_branch_id' | 'identity_expiry_date'>>;

export const useCustomers = createEntityHook<CustomerDTO, CustomerCreateDTO, CustomerUpdateDTO>(
  i18n.t('hooks.useCustomers.text_1'),
  ENDPOINTS.CUSTOMERS.LIST,
);
