import request from '@/utils/request'; export interface CustomerInfo { id: number; customerNo: string; customerName: string; province?: string; city?: string; district?: string; address?: string; contactPerson?: string; contactPhone?: string; postalCode?: string; fax?: string; customerLevel?: string; status: number; salesmanId?: number; createdAt: string; updatedAt: string; } export interface CustomerQuery { page?: number; pageSize?: number; keyword?: string; status?: number; salesmanId?: number; } export interface CustomerListResult { list: CustomerInfo[]; total: number; page: number; pageSize: number; } export interface CustomerCreateParams { customerName: string; province?: string; city?: string; district?: string; address?: string; contactPerson?: string; contactPhone?: string; postalCode?: string; fax?: string; customerLevel?: string; status?: number; salesmanId?: number; } export interface CustomerUpdateParams { customerName?: string; province?: string; city?: string; district?: string; address?: string; contactPerson?: string; contactPhone?: string; postalCode?: string; fax?: string; customerLevel?: string; status?: number; salesmanId?: number; } export interface CustomerStatusParams { status: number; } export interface CustomerStats { total: number; statusCounts: Record; levelCounts: Record; } export const customerApi = { getCustomerList: (params: CustomerQuery) => request.get('/customers', { params }), getCustomerDetail: (id: number) => request.get(`/customers/${id}`), getCustomerOptions: () => request.get('/customers/options/all'), getCustomerStats: () => request.get('/customers/stats'), syncIccCustomers: () => request.post('/customers/sync/icc'), createCustomer: (data: CustomerCreateParams) => request.post('/customers', data), updateCustomer: (id: number, data: CustomerUpdateParams) => request.put(`/customers/${id}`, data), deleteCustomer: (id: number) => request.delete(`/customers/${id}`), updateCustomerStatus: (id: number, status: number) => request.put(`/customers/${id}/status`, { status }), };