import apiRequest from '@/network/http/apiRequest'

/**
 * 获取Customer分页
 * @param data
 * @returns
 */
export function getCustomerByPage(data: any) {
  return apiRequest({
    url: '/customer/page',
    method: 'GET',
    params: data,
  })
}

/**
 * 获取Customer列表
 * @param data
 * @returns
 */
export function getCustomerByList(data: any) {
  return apiRequest({
    url: '/customer',
    method: 'GET',
    params: data,
  })
}

/**
 * 基于Id获取Customer
 * @param customerId 客户ID
 * @returns
 */
export function getCustomerById(customerId: number) {
  return apiRequest({
    url: `/customer/${customerId}`,
    method: 'GET',
  })
}

/**
 * 基于Id获取Customer
 * @returns
 * @param wxId
 */
export function getCustomerByWxId(wxId: string) {
  return apiRequest({
    url: `/customer/wx/${wxId}`,
    method: 'GET',
  })
}

/**
 * 添加Customer
 * @param data
 * @returns
 */
export function createCustomer(data: any) {
  return apiRequest({
    url: '/customer/add',
    method: 'post',
    data,
  })
}

/**
 * 更新Customer
 * @param data
 * @returns
 */
export function updateCustomer(data: any) {
  return apiRequest({
    url: '/customer/update',
    method: 'PUT',
    data,
  })
}

/**
 * 删除Customer
 * @param customerId 客户ID
 * @returns
 */
export function deleteCustomerById(customerId: any) {
  return apiRequest({
    url: `/customer/${customerId}`,
    method: 'DELETE',
  })
}
