import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ServiceTabVO, ServiceTabForm, ServiceTabQuery } from '@/api/system/physical/serviceTab/types';

/**
 * 查询服务页面页签管理列表
 * @param query
 * @returns {*}
 */

export const listServiceTab = (query?: ServiceTabQuery): AxiosPromise<ServiceTabVO[]> => {
  return request({
    url: '/physical/serviceTab/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询服务页面页签管理详细
 * @param id
 */
export const getServiceTab = (id: string | number): AxiosPromise<ServiceTabVO> => {
  return request({
    url: '/physical/serviceTab/' + id,
    method: 'get'
  });
};

/**
 * 新增服务页面页签管理
 * @param data
 */
export const addServiceTab = (data: ServiceTabForm) => {
  return request({
    url: '/physical/serviceTab',
    method: 'post',
    data: data
  });
};

/**
 * 修改服务页面页签管理
 * @param data
 */
export const updateServiceTab = (data: ServiceTabForm) => {
  return request({
    url: '/physical/serviceTab',
    method: 'put',
    data: data
  });
};

/**
 * 删除服务页面页签管理
 * @param id
 */
export const delServiceTab = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/serviceTab/' + id,
    method: 'delete'
  });
};
/**
 * 查询启用的类别
 * @param category
 */
export const selectEnabledTabsByCategoryList = (category: string | number): AxiosPromise<ServiceTabVO> => {
  return request({
    url: '/physical/serviceTab/selectEnabledTabsByCategoryList/' + category,
    method: 'get'
  });
};
