import { apiDelete, apiGet, apiPost, apiPut } from './http' export const login = (phone: string, code: string) => apiPost<{ sessionToken: string; user: Record; store: Record | null }>( '/user/login', { phone, code }, ) export const sendSms = (phone: string) => apiPost('/sms/send', { phone }) export const getUserInfo = () => apiGet>('/user/info') export const getAppointmentList = (params: Record = {}) => apiGet('/appointment/list', params) export const getAppointmentDetail = (id: number) => apiGet('/appointment/detail', { id }) export const startAppointment = (appointmentId: number) => apiPost('/appointment/start', { appointmentId }) export const cancelAppointment = (id: number) => apiPut(`/appointment/status?id=${id}&status=cancel`) export const getReportList = (params: Record = {}) => apiGet('/report/list', params) export const startHighlight = (reportId: number) => apiPost('/report/highlight/start', { reportId }) export const getLeads = (status = 'pending') => apiGet('/report/leads', { status }) export const getServiceCustomers = (params: Record = {}) => apiGet('/admin/service-customers', params) export const getWorkbenchReportFunnel = (date?: string) => apiGet('/admin/workbench/report-funnel', date ? { date } : {}) export const getAdminStore = () => apiGet>('/admin/store') export const updateStore = (data: Record) => apiPut('/store/update', data) export const getScheduleDay = (date: string) => apiGet('/schedule/day', { date }) export const createScheduleBlock = (data: { slotStart: string; durationMinutes: number; blockType: string; note?: string }) => apiPost('/schedule/block', data) export const deleteScheduleBlock = (id: number) => apiDelete('/schedule/block', { id }) export const getStore = (id: number) => apiGet('/store/get', { id }) export const getStaffList = () => apiGet('/user/staff-list') export const createStaff = (data: { name: string; phone: string }) => apiPost('/user/create-staff', data) export const deleteStaff = (staffId: number) => apiDelete('/user/staff', { staffId }) export const getServiceTypeList = (storeId?: number | null) => apiGet('/service-type/list', storeId != null ? { storeId } : {}) export const createServiceType = (name: string, durationMinutes: number) => apiPost('/service-type/create', { name, durationMinutes }) export const updateServiceType = (id: number, name: string, durationMinutes: number) => apiPut('/service-type/update', { id, name, durationMinutes }) export const deleteServiceType = (id: number) => apiDelete('/service-type/delete', { id })