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

/** 用户注册账号 POST /user/admin_register */
export async function postUserAdminRegister(body: API.Register, options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.UserResponse; msg?: string }>(
    `/api/v1/user/admin_register`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 用户修改密码 POST /user/changePassword */
export async function postUserChangePassword(
  body: API.ChangePasswordReq,
  options?: { [key: string]: any },
) {
  return request<API.Response & { msg?: string }>(`/api/v1/user/changePassword`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

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

// /** 获取用户信息 GET /user/getUserInfo */
// export async function getUserGetUserInfo(options?: { [key: string]: any }) {
//   return request<API.Response & { data?: API.UserView; msg?: string }>(`/api/v1/user/getUserInfo`, {
//     method: 'GET',
//     ...(options || {}),
//   });
// }
/** 获取用户信息 GET /user/getUserInfo */
export async function getUserGetUserInfo(options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.UserView; msg?: string }>(`/api/get_user_info/`, {
    method: 'GET',
    ...(options || {}),
  });
}

/** 分页获取用户列表 POST /user/getUserList */
// export async function postUserGetUserList(body: API.PageInfo, options?: { [key: string]: any }) {
//   return request<API.Response & { data?: API.PageResult; msg?: string }>(
//     `/api/v1/user/getUserList`,
//     {
//       method: 'POST',
//       headers: {
//         'Content-Type': 'application/json',
//       },
//       data: body,
//       ...(options || {}),
//     },
//   );
// }
export async function getUserList(
  params: API.SearchAlarmRulesParams | any,
  options?: { [key: string]: any },
) {
  return request<API.Response & { data?: API.PageResult; msg?: string }>(
    `/api/user/`,
    {
      method: 'GET',
      headers: {
        'Content-Type': 'application/json',
      },
      params: {
        ...params,
      },
      ...(options || {}),
    },
  );
}

/** 更新用户列表 */
export async function postUserList(
  body: API.UserList,
  options?: { [key: string]: any },
) {
  return request<API.Response & { data?: API.PageResult; msg?: string }>(
    `/api/user/`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 重置用户密码 POST /user/resetPassword */
export async function postUserResetPassword(body: API.User, options?: { [key: string]: any }) {
  return request<API.Response & { msg?: string }>(`/api/v1/user/resetPassword`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 设置用户信息 PUT /user/SetSelfInfo */
export async function putUserSetSelfInfo(body: API.User, options?: { [key: string]: any }) {
  return request<API.Response & { data?: Record<string, any>; msg?: string }>(
    `/api/v1/user/SetSelfInfo`,
    {
      method: 'PUT',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 设置用户信息 PUT /user/setUserInfo */
export async function putUserSetUserInfo(body: API.User, options?: { [key: string]: any }) {
  return request<API.Response & { data?: Record<string, any>; msg?: string }>(
    `/api/v1/user/setUserInfo`,
    {
      method: 'PUT',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 更改用户权限 POST /user/setUserRole */
export async function postUserSetUserRole(body: API.SetUserRole, options?: { [key: string]: any }) {
  return request<API.Response & { msg?: string }>(`/api/v1/user/setUserRole`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 设置用户权限 POST /user/setUserRoles */
export async function postUserSetUserRoles(
  body: API.SetUserRoles,
  options?: { [key: string]: any },
) {
  return request<API.Response & { msg?: string }>(`/api/v1/user/setUserRoles`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
