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

/**
 * 查询服务标签列表
 * @param query
 * @returns {*}
 */

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

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

/**
 * 新增服务标签
 * @param data
 */
export const addTag = (data: TagForm) => {
  return request({
    url: '/physical/tag',
    method: 'post',
    data: data
  });
};

/**
 * 修改服务标签
 * @param data
 */
export const updateTag = (data: TagForm) => {
  return request({
    url: '/physical/tag',
    method: 'put',
    data: data
  });
};

/**
 * 删除服务标签
 * @param id
 */
export const delTag = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/tag/' + id,
    method: 'delete'
  });
};
export const selectAllPhysicalTagsSelList = (): AxiosPromise<TagVO[]> => {
  return request({
    url: '/physical/tag/selectAllPhysicalTagsSelList',
    method: 'get'
  });
};
