/* eslint-disable */
// @ts-ignore
import request from '@/http/vue-query';
import { CustomRequestOptions } from '@/http/types';

import * as API from './types';

/** 获取系统用户列表 获取系统用户列表，支持按用户名、手机号、昵称筛选 GET /sys/users */
export async function sysUsersUsingGet({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersUsingGetParams;
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: {
        list?: API.SysUser[];
        page?: number;
        page_size?: number;
        total?: number;
      };
    }
  >('/sys/users', {
    method: 'GET',
    params: {
      // page has a default value: 1
      page: '1',
      // page_size has a default value: 10
      page_size: '10',

      ...params,
    },
    ...(options || {}),
  });
}

/** 创建系统用户 创建新的系统用户（包含手机号） POST /sys/users */
export async function sysUsersUsingPost({
  body,
  options,
}: {
  body: API.CreateSysUserRequest;
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: API.SysUser;
    }
  >('/sys/users', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据ID获取系统用户 根据用户ID获取特定系统用户的详细信息 GET /sys/users/${param0} */
export async function sysUsersUidUsingGet({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersUidUsingGetParams;
  options?: CustomRequestOptions;
}) {
  const { uid: param0, ...queryParams } = params;

  return request<
    API.Response & {
      data?: API.SysUser;
    }
  >(`/sys/users/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新系统用户 根据ID更新系统用户信息 PUT /sys/users/${param0} */
export async function sysUsersUidUsingPut({
  params,
  body,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersUidUsingPutParams;
  body: API.UpdateSysUserRequest;
  options?: CustomRequestOptions;
}) {
  const { uid: param0, ...queryParams } = params;

  return request<
    API.Response & {
      data?: API.SysUser;
    }
  >(`/sys/users/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 删除系统用户 根据ID删除系统用户（软删除） DELETE /sys/users/${param0} */
export async function sysUsersUidUsingDelete({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersUidUsingDeleteParams;
  options?: CustomRequestOptions;
}) {
  const { uid: param0, ...queryParams } = params;

  return request<
    API.Response & {
      message?: string;
    }
  >(`/sys/users/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 管理员修改用户密码 管理员直接修改用户密码，无需旧密码和确认密码 PUT /sys/users/${param0}/password */
export async function sysUsersUidPasswordUsingPut({
  params,
  body,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersUidPasswordUsingPutParams;
  body: API.ChangePasswordRequest;
  options?: CustomRequestOptions;
}) {
  const { uid: param0, ...queryParams } = params;

  return request<unknown>(`/sys/users/${param0}/password`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 获取用户权限 获取系统用户的权限列表 GET /sys/users/${param0}/permissions */
export async function sysUsersUidPermissionsUsingGet({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersUidPermissionsUsingGetParams;
  options?: CustomRequestOptions;
}) {
  const { uid: param0, ...queryParams } = params;

  return request<
    API.Response & {
      data?: API.SysMenu[];
    }
  >(`/sys/users/${param0}/permissions`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 检查用户权限 检查系统用户是否有特定权限 GET /sys/users/${param0}/permissions/check */
export async function sysUsersUidPermissionsCheckUsingGet({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersUidPermissionsCheckUsingGetParams;
  options?: CustomRequestOptions;
}) {
  const { uid: param0, ...queryParams } = params;

  return request<
    API.Response & {
      data?: {
        has_permission?: boolean;
      };
    }
  >(`/sys/users/${param0}/permissions/check`, {
    method: 'GET',
    params: {
      ...queryParams,
    },
    ...(options || {}),
  });
}

/** 获取用户角色 获取系统用户的角色列表 GET /sys/users/${param0}/roles */
export async function sysUsersUidRolesUsingGet({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersUidRolesUsingGetParams;
  options?: CustomRequestOptions;
}) {
  const { uid: param0, ...queryParams } = params;

  return request<
    API.Response & {
      data?: API.SysRole[];
    }
  >(`/sys/users/${param0}/roles`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 分配用户角色 为系统用户分配角色（自动获取当前操作用户信息） POST /sys/users/${param0}/roles */
export async function sysUsersUidRolesUsingPost({
  params,
  body,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersUidRolesUsingPostParams;
  body: API.AssignSysRoleRequest;
  options?: CustomRequestOptions;
}) {
  const { uid: param0, ...queryParams } = params;

  return request<
    API.Response & {
      data?: string;
    }
  >(`/sys/users/${param0}/roles`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 移除用户角色 移除系统用户的角色 DELETE /sys/users/${param0}/roles */
export async function sysUsersUidRolesUsingDelete({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersUidRolesUsingDeleteParams;
  options?: CustomRequestOptions;
}) {
  const { uid: param0, ...queryParams } = params;

  return request<
    API.Response & {
      data?: string;
    }
  >(`/sys/users/${param0}/roles`, {
    method: 'DELETE',
    params: {
      ...queryParams,
    },
    ...(options || {}),
  });
}

/** 重置用户密码 通过用户名、手机号、验证码重置用户密码 POST /sys/users/reset-password */
export async function sysUsersResetPasswordUsingPost({
  body,
  options,
}: {
  body: API.ResetPasswordRequest;
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: string;
    }
  >('/sys/users/reset-password', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据调用者身份获取所属学校下的所有学校管理员列表 根据调用者的身份（系统管理员、联考管理员、学校管理员）获取对应学校范围内的所有学校管理员列表 GET /sys/users/school-admins */
export async function sysUsersSchoolAdminsUsingGet({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.sysUsersSchoolAdminsUsingGetParams;
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: {
        list?: API.SysUser[];
        page?: number;
        page_size?: number;
        total?: number;
      };
    }
  >('/sys/users/school-admins', {
    method: 'GET',
    params: {
      // page has a default value: 1
      page: '1',
      // page_size has a default value: 10
      page_size: '10',
      ...params,
    },
    ...(options || {}),
  });
}
