import premierlibrary from 'libpremierlibrary.so';
import ACPM from "@acpm/acpm_ohos_pc";
import { getEnumValues } from '../player/bean/InfoCode';
export class PrivateService {
    constructor() {
        this.nOnPremiumLicenseVerifyCallback = (l49, m49, n49) => {
            let o49 = findPremiumBizTypeByValue(l49);
            let p49 = false;
            if (m49 == 0) {
                p49 = false;
            }
            else {
                p49 = true;
            }
            if (PrivateService.sOnPremiumLicenseVerifyCallback != null) {
                PrivateService.sOnPremiumLicenseVerifyCallback.onPremiumLicenseVerifyCallback(o49, p49, n49);
            }
        };
    }
    static getInstance() {
        if (PrivateService.sInstance == undefined) {
            PrivateService.sInstance = new PrivateService();
        }
        return PrivateService.sInstance;
    }
    static preInitService(g49) {
        ACPM.setup(g49);
        ACPM.getFunctionsBinder().forEach((i49, j49) => {
            premierlibrary.JSBind.bindFunction(j49, i49);
        });
        premierlibrary.nPreInitService();
    }
    static initService(b49, c49) {
        ACPM.setup(b49);
        ACPM.getFunctionsBinder().forEach((e49, f49) => {
            premierlibrary.JSBind.bindFunction(f49, e49);
        });
        premierlibrary.nInitService(c49);
    }
    static initServiceWithBytes(w48, x48) {
        ACPM.setup(w48);
        ACPM.getFunctionsBinder().forEach((z48, a49) => {
            premierlibrary.JSBind.bindFunction(a49, z48);
        });
        premierlibrary.nInitService_bytes(x48);
    }
    static setOnPremiumLicenseVerifyCallback(v48) {
        PrivateService.sOnPremiumLicenseVerifyCallback = v48;
        premierlibrary.nSetOnPremiumLicenseVerifyCallback(PrivateService.getInstance(), v48 != null);
    }
}
PrivateService.sOnPremiumLicenseVerifyCallback = null;
export var PremiumBizType;
(function (u48) {
    u48[u48["BizType_UNKNOW"] = 0] = "BizType_UNKNOW";
    u48[u48["MediaLoader"] = 101] = "MediaLoader";
    u48[u48["PreRenderOption"] = 102] = "PreRenderOption";
    u48[u48["PremiumAbrStrategy"] = 103] = "PremiumAbrStrategy";
    u48[u48["H265Adaptive"] = 104] = "H265Adaptive";
    u48[u48["DashSupport"] = 105] = "DashSupport";
    u48[u48["EXTSubtitle"] = 108] = "EXTSubtitle";
    u48[u48["H266Support"] = 109] = "H266Support";
})(PremiumBizType || (PremiumBizType = {}));
export function findPremiumBizTypeByValue(r48) {
    const s48 = getEnumValues(PremiumBizType);
    for (const t48 of s48) {
        if (t48 === r48) {
            return t48;
        }
    }
    return PremiumBizType.BizType_UNKNOW;
}
