const classJavaName = "com/anythink/cocosjs/ATInterstitialJSBridge";

const ATAndroidInterstitialJS = {
    
    loadInterstitial(placementId: string, settings: string): void {
        cc.log("Android-loadInterstitial");
        jsb.reflection.callStaticMethod(
            classJavaName,
            "load",
            "(Ljava/lang/String;Ljava/lang/String;)V",
            placementId,
            settings
        );
    },

    setAdListener(listener: string): void {
        cc.log("Android-setAdListener");
        jsb.reflection.callStaticMethod(
            classJavaName,
            "setAdListener",
            "(Ljava/lang/String;)V",
            listener
        );
    },

    hasAdReady(placementId: string): boolean {
        cc.log("Android-hasAdReady");
        return jsb.reflection.callStaticMethod(
            classJavaName,
            "isAdReady",
            "(Ljava/lang/String;)Z",
            placementId
        );
    },

    checkAdStatus(placementId: string): string {
        cc.log("Android-checkAdStatus:" + placementId);
        return jsb.reflection.callStaticMethod(
            classJavaName,
            "checkAdStatus",
            "(Ljava/lang/String;)Ljava/lang/String;",
            placementId
        );
    },

    showAd(placementId: string): void {
        cc.log("Android-showAd:" + placementId);
        jsb.reflection.callStaticMethod(
            classJavaName,
            "show",
            "(Ljava/lang/String;)V",
            placementId
        );
    },

    showAdInScenario(placementId: string, scenario: string): void {
        cc.log("Android-showAdInScenario:" + placementId + "---" + scenario);
        jsb.reflection.callStaticMethod(
            classJavaName,
            "show",
            "(Ljava/lang/String;Ljava/lang/String;)V",
            placementId,
            scenario
        );
    }

};

export default ATAndroidInterstitialJS;
