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

import * as API from './types';

/** 验证码登录 使用手机号和验证码进行登录 POST /auth/code-login */
export async function authCodeLoginUsingPost({
  body,
  options,
}: {
  body: API.CodeLoginRequest;
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: API.CodeLoginResponse;
    }
  >('/auth/code-login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取验证码 发送验证码到指定手机号，支持登录和重置密码两种类型 GET /auth/get-code */
export async function authGetCodeUsingGet({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.authGetCodeUsingGetParams;
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: API.VerificationCodeResponse;
    }
  >('/auth/get-code', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 用户登录 用户登录并返回JWT令牌，支持用户名或手机号登录 POST /auth/login */
export async function authLoginUsingPost({
  body,
  options,
}: {
  body: API.LoginRequest;
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: API.LoginResponse;
    }
  >('/auth/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取用户信息 获取当前登录用户的详细信息 GET /auth/profile */
export async function authProfileUsingGet({
  options,
}: {
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: API.SysUser;
    }
  >('/auth/profile', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 刷新访问令牌 使用刷新令牌获取新的访问令牌 POST /auth/refresh */
export async function authRefreshUsingPost({
  body,
  options,
}: {
  body: API.RefreshTokenRequest;
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: API.LoginResponse;
    }
  >('/auth/refresh', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 重置密码 重置用户密码 POST /auth/reset-password */
export async function authResetPasswordUsingPost({
  body,
  options,
}: {
  body: API.ResetPasswordRequest;
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: API.ResetPasswordResponse;
    }
  >('/auth/reset-password', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 验证重置验证码 验证重置密码验证码，从缓存中获取当前手机号对应的code进行验证 GET /auth/verify-reset-code */
export async function authVerifyResetCodeUsingGet({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.authVerifyResetCodeUsingGetParams;
  options?: CustomRequestOptions;
}) {
  return request<
    API.Response & {
      data?: boolean;
    }
  >('/auth/verify-reset-code', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
