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

export type BankBook = {
  id?: string;
  bankName: string;
  accountNumber: string;
  bankBranch: string;
  accountName: string;
  accountType: string;
  currentlyUse: boolean;
  bankQr?: File;
  bankUrl?: string;
  branchId?: string;
};

export type Branch = {
  permitExpireDate: Date;
  permitIssueDate: Date;
  permitNo: string;
  selectedImage?: string;
  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;
  email: string;
  zipCode: string;
  subDistrictId: string | null;
  districtId: string | null;
  provinceId: string | null;
  addressEN: string;
  address: string;
  moo?: string;
  mooEN?: string;
  soi?: string;
  soiEN?: string;
  street?: string;
  streetEN?: 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;
  };
  virtual: boolean;
  webUrl: string;
};

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

export type BranchCreate = {
  permitExpireDate: Date;
  permitIssueDate: Date;
  permitNo: string;
  selectedImage?: string;
  code?: string;
  taxNo: string;
  nameEN: string;
  name: string;
  addressEN: string;
  address: string;
  moo?: string;
  mooEN?: string;
  soi?: string;
  soiEN?: string;
  street?: string;
  streetEN?: 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;
  lineId: string;
  webUrl?: string;
  virtual: boolean;
};

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