import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FlfTagVO, FlfTagForm, FlfTagQuery } from './types';

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

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

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

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

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

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