import { FormInstance } from 'antd';
import { LoginApiParams } from '@/apis';

interface CaptchaData{
    uuid: string,
    img: string,
};
// 定义状态
export type State = {
    buttonLoading: boolean,
    captchaData:CaptchaData
    tenantEnabled?: boolean,
    tenantEnabledList?: any[],
};

// 只读状态
export type ReadonlyState = Readonly<State>;

// 修改状态
export type StateAction = {
    setButtonLoading: (loading: State['buttonLoading']) => void,
    setCaptchaData: (data: any) => void,
    setTenantEnabled: (data: any) => void,
};

// 仓库类型
export type LoginStore = {
    state: ReadonlyState,
    onClickLogin: (data: LoginApiParams, remember: boolean,navigate?:any,redirectUrl?:any) => Promise<any>,
    onCaptchaImage: () => Promise<any>,
    init: (form: FormInstance,navigate?:any) => void,
    reset: () => void,
    onFetchClientRouters: (navigate:any) => Promise<any>,
};