// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 新增菜单 POST /menu/createMenu */
export async function postMenuCreateMenu(body: API.Menu, options?: { [key: string]: any }) {
  return request<API.Response & { msg?: string }>(`/api/v1/menu/createMenu`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除菜单 DELETE /menu/deleteMenu */
export async function deleteMenuDeleteMenu(body: API.GetById, options?: { [key: string]: any }) {
  return request<API.Response & { msg?: string }>(`/api/v1/menu/deleteMenu`, {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取用户动态路由 POST /menu/getMenu */
export async function postMenuGetMenu(options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.RoutesResponse; msg?: string }>(
    `/api/v1/menu/getMenu`,
    {
      method: 'POST',
      ...(options || {}),
    },
  );
}

/** 分页获取基础menu列表 POST /menu/getMenuList */
export async function postMenuGetMenuList(body: API.PageInfo, options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.PageResult; msg?: string }>(
    `/api/v1/menu/getMenuList`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 获取用户菜单树 POST /menu/getMenuTree */
export async function postMenuGetMenuTree(options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.TreeResponse; msg?: string }>(
    `/api/v1/menu/getMenuTree`,
    {
      method: 'POST',
      ...(options || {}),
    },
  );
}

/** 更新菜单 PUT /menu/updateMenu */
export async function putMenuUpdateMenu(body: API.Menu, options?: { [key: string]: any }) {
  return request<API.Response & { msg?: string }>(`/api/v1/menu/updateMenu`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
