import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CustomerTagVO, CustomerTagForm, CustomerTagQuery } from '@/api/customer/customerCategory/customerTag/types';

/**
 * 查询客户标签列表
 * @param query
 * @returns {*}
 */

export const listCustomerTag = (query?: CustomerTagQuery): AxiosPromise<CustomerTagVO[]> => {
  return request({
    url: '/customer/customerTag/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询客户标签详细
 * @param id
 */
export const getCustomerTag = (id: string | number): AxiosPromise<CustomerTagVO> => {
  return request({
    url: '/customer/customerTag/' + id,
    method: 'get'
  });
};

/**
 * 新增客户标签
 * @param data
 */
export const addCustomerTag = (data: CustomerTagForm) => {
  return request({
    url: '/customer/customerTag',
    method: 'post',
    data: data
  });
};

/**
 * 修改客户标签
 * @param data
 */
export const updateCustomerTag = (data: CustomerTagForm) => {
  return request({
    url: '/customer/customerTag',
    method: 'put',
    data: data
  });
};

/**
 * 删除客户标签
 * @param id
 */
export const delCustomerTag = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/customerTag/' + id,
    method: 'delete'
  });
};
