import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TagCategoryVO, TagCategoryForm, TagCategoryQuery } from '@/api/customer/customerCategory/tagCategory/types';

/**
 * 查询标签类别信息列表
 * @param query
 * @returns {*}
 */

export const listTagCategory = (query?: TagCategoryQuery): AxiosPromise<TagCategoryVO[]> => {
  return request({
    url: '/customer/tagCategory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询标签类别信息详细
 * @param id
 */
export const getTagCategory = (id: string | number): AxiosPromise<TagCategoryVO> => {
  return request({
    url: '/customer/tagCategory/' + id,
    method: 'get'
  });
};

/**
 * 新增标签类别信息
 * @param data
 */
export const addTagCategory = (data: TagCategoryForm) => {
  return request({
    url: '/customer/tagCategory',
    method: 'post',
    data: data
  });
};

/**
 * 修改标签类别信息
 * @param data
 */
export const updateTagCategory = (data: TagCategoryForm) => {
  return request({
    url: '/customer/tagCategory',
    method: 'put',
    data: data
  });
};

/**
 * 删除标签类别信息
 * @param id
 */
export const delTagCategory = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/tagCategory/' + id,
    method: 'delete'
  });
};
