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

/** 创建角色 POST /role/createRole */
export async function postRoleCreateRole(body: API.Role, options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.RoleResponse; msg?: string }>(
    `/api/v1/role/createRole`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 分页获取角色列表 POST /role/getRoleFkSelect */
export async function postRoleGetRoleFkSelect(
  body: API.GetFkSelect,
  options?: { [key: string]: any },
) {
  return request<API.Response & { data?: API.FkResult; msg?: string }>(
    `/api/v1/role/getRoleFkSelect`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

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

/** 获取角色权限 POST /role/getRolePermission */
export async function postRoleGetRolePermission(
  body: API.GetById,
  options?: { [key: string]: any },
) {
  return request<API.Response & { data?: API.RolePermissionResponse }>(
    `/api/v1/role/getRolePermission`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 更新角色信息 PUT /role/updateRole */
export async function putRoleUpdateRole(body: API.Role, options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.RoleResponse; msg?: string }>(
    `/api/v1/role/updateRole`,
    {
      method: 'PUT',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 更新角色权限 PUT /role/updateRolePermission */
export async function putRoleUpdateRolePermission(
  body: API.UpdateRolePermissionParams,
  options?: { [key: string]: any },
) {
  return request<any>(`/api/v1/role/updateRolePermission`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
