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

const ATAndroidBannerJS = {
    
    loadBanner(placementId: string, settings: string): void {
        cc.log("Android-loadBanner:" + settings);
        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
        );
    },

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

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

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

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

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

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

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

export default ATAndroidBannerJS;
