package com.foxx.androidcast.entitlements;

import android.content.Context;

/**
 * App-wide gate for paid capabilities decoded from the per-account obfuscated blob.
 * Until feature-specific bits are defined, {@link #hasAnyPaidFeature} is the primary check.
 */
public final class PaidEntitlements {
    private PaidEntitlements() {}

    public static long getFlags(Context context) {
        return EntitlementCoordinator.getInstance(context).getFlags();
    }

    public static boolean hasAnyPaidFeature(Context context) {
        return EntitlementCoordinator.getInstance(context).hasAnyPaidFeature();
    }

    public static boolean hasFeature(Context context, long featureBit) {
        return EntitlementCoordinator.getInstance(context).hasFeature(featureBit);
    }

    public static boolean isNativeGateAvailable(Context context) {
        return EntitlementCoordinator.getInstance(context).isNativeLibraryAvailable();
    }

    public static void refresh(Context context) {
        EntitlementCoordinator coord = EntitlementCoordinator.getInstance(context);
        coord.reloadFromLocal();
        coord.scheduleBackendSync();
    }
}
