// @ts-ignore
/* eslint-disable */

// 该文件自动生成，请勿手动修改！

// --------------------------------------------------------------------------
// 用户登录认证服务
// --------------------------------------------------------------------------

import { request } from '@umijs/max';

/** 账户密码登录 POST /api/sys/auth/login-by-account */
export async function loginByAccount(data: API.LoginInput, options?: { [key: string]: any }) {
    const url = '/api/sys/auth/login-by-account';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<API.AuthOutput>>(url, config);
    return res?.data;
}

/** 退出登录 POST /api/sys/auth/logout */
export async function logout(options?: { [key: string]: any }) {
    const url = '/api/sys/auth/logout';
    const config = { method: 'POST', ...(options || {}) };
    const res = await request<API.ResponseType<any>>(url, config);
    return res?.data;
}

/** 获取当前登录用户信息 GET /api/sys/auth/get-login-user */
export async function getLoginUser(options?: { [key: string]: any }) {
    const url = '/api/sys/auth/get-login-user';
    const config = { method: 'GET', ...(options || {}) };
    const res = await request<API.ResponseType<API.LoginOutput>>(url, config);
    return res?.data;
}

/** 获取图形验证码 GET /api/sys/auth/get-captcha */
export async function getCaptcha(options?: { [key: string]: any }) {
    const url = '/api/sys/auth/get-captcha';
    const config = { method: 'GET', ...(options || {}) };
    const res = await request<API.ResponseType<API.GeneralCaptchaOutput>>(url, config);
    return res?.data;
}

/** 校验图形验证码 POST /api/sys/auth/verify-captcha */
export async function verifyCaptcha(
    data: API.GeneralCaptchaInput,
    options?: { [key: string]: any },
) {
    const url = '/api/sys/auth/verify-captcha';
    const config = { method: 'POST', data, ...(options || {}) };
    const res = await request<API.ResponseType<API.GeneralCaptchaOutput>>(url, config);
    return res?.data;
}

export default {
    /** 账户密码登录 POST /api/sys/auth/login-by-account */
    loginByAccount,
    /** 退出登录 POST /api/sys/auth/logout */
    logout,
    /** 获取当前登录用户信息 GET /api/sys/auth/get-login-user */
    getLoginUser,
    /** 获取图形验证码 GET /api/sys/auth/get-captcha */
    getCaptcha,
    /** 校验图形验证码 POST /api/sys/auth/verify-captcha */
    verifyCaptcha,
};
