import AppData from "../Common/AppData";


class UserUtil {
    
    static isLoggedIn() {
        const user_data = AppData.getInstance().get('user_data');
        if (user_data === null) {
            return false;
        }
        return user_data?.is_logged_in;
    }

    static getUserEmail() {
        const { user_email } = AppData.getInstance().get('user_data');
        return user_email;
    }

    static getUserMetaByKey(key, defaultValue = null) {
        return AppData.getInstance().getMetaByKey(key, defaultValue);
    }

    static setUserMetaByKey(key, value) {
        AppData.getInstance().setMetaByKey(key, value);
    }

    static getUserId() {
        const user_data = AppData.getInstance().get('user_data');
        if (user_data === null) {
            return null;
        }
        return user_data.user_id;
    }
}
export default UserUtil;