declare namespace API {
    type UserInfo = {
        accessToken?: string;
        refreshToken?: string;
        accessExpires?: number;
        country?: string;
        countryName?: string;
        userIp?: string;
        createTime?: number;
        geographyEea?: boolean;
        memberLevel?: number;
        userLevel?: number;
        expireTime?: number;
        remainTime?: number;
        isExpired?: boolean;
        isTestUser?: boolean;
        isSubscribeUser?: boolean;
        account?: Account;
        planInfo?: PlanInfo;
    };

    type Account = {
        username?: string;
        phone?: string;
        email?: string;
        wechat?: string;
        qq?: string;
        google?: string;
        apple?: string;
    };

    type PlanInfo = {
        channelItemId?: string;
        title?: string;
        subTitle?: string;
        introduce?: string;
        orgPrice?: number;
        price?: number;
        tag?: string;
        tagType?: number;
        currency?: number;
        recommend?: boolean;
        isDefault?: boolean;
        sort?: number;
        deviceLimit?: number;
        isSubscribe?: boolean;
        subscribeType?: number;
        subscribePeriodValue?: number;
        payoutType?: string;
        payoutData?: string;
        ServicePlanId?: number;
        ServiceChannelPlanId?: number;
    };

    type LoginParams = {
        account: string;
        password: string;
        captchaId?: string; // 新的登录接口不用验证码
        captchaCode?: string; // 新的登录接口不用验证码
    };

    type LoginResult = Result<{
        userConfig: UserInfo;
    }>;

    type RefreshTokenInfo = {
        /** token */
        accessToken: string;
        /** 用于调用刷新accessToken的接口时所需的token */
        refreshToken: string;
        /** `accessToken`的过期时间（unix时间戳） */
        expires: number;
    };
    type RefreshTokenResult = Result<RefreshTokenInfo>;

    type CaptchaInfo = {
        base64image: string;
        id: string;
    };
    type CaptchaResult = Result<CaptchaInfo>;
}
