import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HomeTabConfigVO, HomeTabConfigForm, HomeTabConfigQuery } from '@/api/system/physical/homeTabConfig/types';

/**
 * 查询首页页签开关配置列表
 * @param query
 * @returns {*}
 */

export const listHomeTabConfig = (query?: HomeTabConfigQuery): AxiosPromise<HomeTabConfigVO[]> => {
  return request({
    url: '/physical/homeTabConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询首页页签开关配置详细
 * @param id
 */
export const getHomeTabConfig = (id: string | number): AxiosPromise<HomeTabConfigVO> => {
  return request({
    url: '/physical/homeTabConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增首页页签开关配置
 * @param data
 */
export const addHomeTabConfig = (data: HomeTabConfigForm) => {
  return request({
    url: '/physical/homeTabConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改首页页签开关配置
 * @param data
 */
export const updateHomeTabConfig = (data: HomeTabConfigForm) => {
  return request({
    url: '/physical/homeTabConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除首页页签开关配置
 * @param id
 */
export const delHomeTabConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/homeTabConfig/' + id,
    method: 'delete'
  });
};
