import { faker } from '@faker-js/faker/locale/zh_CN'; export type employee = { level: string, name: string }; interface CustomerOptions { username?: string; phone?: string; archive?: string; gender?: number; source?: number; birthday?: { year: number; month: number; day: number }; remark?: string; employees?: employee[]; } export class Customer { store: number; department: number; username: string; phone: string; archive: string; gender: number; birthday?: { year: number; month: number; day: number }; source: number; remark: string; employees: employee[]; constructor(store: number, department: number, options: CustomerOptions = {}) { this.store = store; this.department = department; this.username = options.username ?? faker.person.fullName(); this.phone = options.phone ?? faker.helpers.fromRegExp(/1[3-9][0-9]{6}/); this.archive = options.archive ?? ''; this.gender = options.gender ?? 0; this.source = options.source ?? 1; this.birthday = options.birthday; this.remark = options.remark ?? ''; this.employees = options.employees ?? []; } }