import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SysTagVO, SysTagForm, SysTagQuery } from '@/api/archieves/tag/types';

/**
 * 查询标签列表
 */
export const listTag = (query?: SysTagQuery): AxiosPromise<SysTagVO[]> => {
  return request({
    url: '/archieves/tag/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询全部标签（不分页）
 */
export const listAllTag = (query?: SysTagQuery): AxiosPromise<SysTagVO[]> => {
  return request({
    url: '/archieves/tag/listAll',
    method: 'get',
    params: query
  });
};

/**
 * 查询标签详细
 */
export const getTag = (id: string | number): AxiosPromise<SysTagVO> => {
  return request({
    url: '/archieves/tag/' + id,
    method: 'get'
  });
};

/**
 * 新增标签
 */
export const addTag = (data: SysTagForm) => {
  return request({
    url: '/archieves/tag',
    method: 'post',
    data: data
  });
};

/**
 * 修改标签
 */
export const updateTag = (data: SysTagForm) => {
  return request({
    url: '/archieves/tag',
    method: 'put',
    data: data
  });
};

/**
 * 删除标签
 */
export const delTag = (id: string | number | Array<string | number>) => {
  return request({
    url: '/archieves/tag/' + id,
    method: 'delete'
  });
};
