import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TagVO, TagForm, TagQuery } from '@/api/system/business/tag/types';

/**
 * 查询类目与标签合并列表
 * @param query
 * @returns {*}
 */

export const listTag = (query?: TagQuery): AxiosPromise<TagVO[]> => {
  return request({
    url: '/business/tag/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询类目与标签合并详细
 * @param id
 */
export const getTag = (id: string | number): AxiosPromise<TagVO> => {
  return request({
    url: '/business/tag/' + id,
    method: 'get'
  });
};

/**
 * 新增类目与标签合并
 * @param data
 */
export const addTag = (data: TagForm) => {
  return request({
    url: '/business/tag',
    method: 'post',
    data: data
  });
};

/**
 * 修改类目与标签合并
 * @param data
 */
export const updateTag = (data: TagForm) => {
  return request({
    url: '/business/tag',
    method: 'put',
    data: data
  });
};

/**
 * 删除类目与标签合并
 * @param id
 */
export const delTag = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/tag/' + id,
    method: 'delete'
  });
};

/**
 * 查询标签列表
 */
export const selectTagSelList = (): AxiosPromise<TagVO[]> => {
  return request({
    url: '/business/tag/selectTagSelList',
    method: 'get'
  });
};
/**
 * 查询类别列表
 */
export const selectCategorySelList = (): AxiosPromise<TagVO[]> => {
  return request({
    url: '/business/tag/selectCategorySelList',
    method: 'get'
  });
};
