import { District, Province, SubDistrict } from '../address';
import { BranchContact } from '../branch-contact/types';
import { Status } from '../types';

export type BankBook = {
  bankName: string;
  accountNumber: string;
  bankBranch: string;
  accountName: string;
  accountType: string;
  currentlyUse: boolean;
};

export type Branch = {
  subDistrict: SubDistrict | null;
  district: District | null;
  province: Province | null;
  updatedAt: string;
  updatedBy: string;
  createdAt: string;
  createdBy: string;
  status: Status;
  headOfficeId: string | null;
  isHeadOffice: boolean;
  longitude: string;
  latitude: string;
  contactName: string;
  qrCodeImageUrl: string;
  imageUrl: string;
  email: string;
  zipCode: string;
  subDistrictId: string | null;
  districtId: string | null;
  provinceId: string | null;
  addressEN: string;
  address: string;
  nameEN: string;
  name: string;
  taxNo: string;
  id: string;
  code: string;
  telephoneNo: string;
  bank: (BankBook & { id: string; branchId: string })[];
  lineId: string;
  contact: BranchContact[];
  _count: {
    branch: number;
  };
};

export type BranchWithChildren = Branch & { branch: Branch[] };

export type BranchCreate = {
  code?: string;
  taxNo: string;
  nameEN: string;
  name: string;
  addressEN: string;
  address: string;
  zipCode: string;
  email: string;
  longitude: string;
  latitude: string;
  status?: Status;
  subDistrictId?: string | null;
  districtId?: string | null;
  provinceId?: string | null;
  headOfficeId?: string | null;
  telephoneNo: string;
  contactName: string;
  contact: string;
  qrCodeImage?: File;
  imageUrl?: File;
  lineId: string;
};

export type BranchUserStats = {
  id: string;
  nameEN: string;
  name: string;
  count: number;
  isHeadOffice: boolean;
};
