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

const ATAndroidBannerJS = {
    
    loadNative(placementId: string, settings: string): void {
        cc.log("Android-loadNative");
        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, adViewProperty: string): void {
        cc.log("Android-showAd");
        jsb.reflection.callStaticMethod(
            classJavaName,
            "show",
            "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",
            placementId,
            adViewProperty,
            ""
        );
    },

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

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

};

export default ATAndroidBannerJS;
