import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MenuVO, MenuForm, MenuQuery } from '@/api/system/menu/types';

/**
 * 查询赛事菜单关联列表
 * @param query
 * @returns {*}
 */

export const listMenu = (query?: MenuQuery): AxiosPromise<MenuVO[]> => {
  return request({
    url: '/system/menu/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询赛事菜单关联详细
 * @param id
 */
export const getMenu = (id: string | number): AxiosPromise<MenuVO> => {
  return request({
    url: '/system/menu/' + id,
    method: 'get'
  });
};

/**
 * 新增赛事菜单关联
 * @param data
 */
export const addMenu = (data: MenuForm) => {
  return request({
    url: '/system/menu',
    method: 'post',
    data: data
  });
};

/**
 * 修改赛事菜单关联
 * @param data
 */
export const updateMenu = (data: MenuForm) => {
  return request({
    url: '/system/menu',
    method: 'put',
    data: data
  });
};

/**
 * 删除赛事菜单关联
 * @param id
 */
export const delMenu = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/menu/' + id,
    method: 'delete'
  });
};
