import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ItemsVO, ItemsForm, ItemsQuery } from '@/api/system/business/items/types';

/**
 * 查询道具列表
 * @param query
 * @returns {*}
 */

export const listItems = (query?: ItemsQuery): AxiosPromise<ItemsVO[]> => {
  return request({
    url: '/business/items/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询道具详细
 * @param id
 */
export const getItems = (id: string | number): AxiosPromise<ItemsVO> => {
  return request({
    url: '/business/items/' + id,
    method: 'get'
  });
};

/**
 * 新增道具
 * @param data
 */
export const addItems = (data: ItemsForm) => {
  return request({
    url: '/business/items',
    method: 'post',
    data: data
  });
};

/**
 * 修改道具
 * @param data
 */
export const updateItems = (data: ItemsForm) => {
  return request({
    url: '/business/items',
    method: 'put',
    data: data
  });
};

/**
 * 删除道具
 * @param id
 */
export const delItems = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/items/' + id,
    method: 'delete'
  });
};

/**
 * 获取报名条件信息
 * @param id
 */
export const selectItemsSelList = (): AxiosPromise<ItemsVO> => {
  return request({
    url: '/business/items/selectItemsSelList',
    method: 'get'
  });
};
export const selectXianXiaItemsSelList = (): AxiosPromise<ItemsVO> => {
  return request({
    url: '/business/items/selectXianXiaItemsSelList',
    method: 'get'
  });
};
export const selectServiceItemsSelList = (): AxiosPromise<ItemsVO> => {
  return request({
    url: '/business/items/selectServiceItemsSelList',
    method: 'get'
  });
};
