import { http } from '../http/client' import type { CustomerDashboardSummary, CustomerDetailEntity, CustomerEntity, PaginatedCustomerList, } from './contracts' export type { CustomerDashboardSummary, CustomerDetailEntity, CustomerEntity, PaginatedCustomerList, } from './contracts' export type CustomerUpsertInput = { name: string namePronunciation?: string phone: string email?: string birthday?: string avatar?: string expectContact?: 'LINE' | 'PHONE' | 'EMAIL' | 'NONE' hairLength?: 'SHORT' | 'MEDIUM' | 'LONG' | 'UNCONFIRM' hairTexture?: 'UNCONFIRM' | 'THIN' | 'NORMAL' | 'HARD_CRUDE' | 'CURLY' notice?: string allergy?: string innerRemark?: string nextFollowDate?: string recommendVisitDate?: string firstSuggestHair?: 'AUTO' | 'LONG' | 'MEDIUM' | 'SHORT' planDate?: string visitPurpose?: 'CUT_DYE' | 'CUT' | 'DYE' | 'CONSULT_SIM' trouble?: string consultContent?: string expectLook?: string } export async function listCustomers( params: { page?: number pageSize?: number q?: string visitStatus?: string followStatus?: string hairLength?: string } = {}, ): Promise { const query = new URLSearchParams() if (params.page) query.set('page', String(params.page)) if (params.pageSize) query.set('pageSize', String(params.pageSize)) if (params.q) query.set('q', params.q) if (params.visitStatus) query.set('visitStatus', params.visitStatus) if (params.followStatus) query.set('followStatus', params.followStatus) if (params.hairLength) query.set('hairLength', params.hairLength) const qs = query.toString() return http.get(`/customers${qs ? `?${qs}` : ''}`) } export async function createCustomer(input: CustomerUpsertInput): Promise { return http.post('/customers', input) } export async function getCustomerById(customerId: string): Promise { return http.get(`/customers/${customerId}`) } export async function getCustomerDashboardSummary(): Promise { return http.get('/customers/summary') }