import ATiOSJS from "./ATiOSJS"; // Assuming ATiOSJS is exported as a module

const OC_WRAPPER_CLASS = "ATBannerAdWrapper";

interface AdListener {
    // Define the structure of the listener if known
}

interface ShowAdRectangle {
    // Define the structure for the rectangle if known
}

const ATiOSBannerJS = {
    loadBanner(placementId: string, extra: string): void {
        ATiOSJS.printJsLog(`ATiOSBannerJS::loadBanner(${placementId}, ${extra})`);
        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "loadBannerWithPlacementID:extra:", placementId, extra);
    },

    setAdListener(listener: AdListener): void {
        ATiOSJS.printJsLog(`ATiOSBannerJS::setAdListener(${JSON.stringify(listener)})`);
        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "setDelegates:", JSON.stringify(listener));
    },

    hasAdReady(placementId: string): boolean {
        ATiOSJS.printJsLog(`ATiOSBannerJS::hasAdReady(${placementId})`);
        return jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "bannerReadyForPlacementID:", placementId);
    },

    checkAdStatus(placementId: string): string {
        ATiOSJS.printJsLog(`ATiOSBannerJS::checkAdStatus(${placementId})`);
        return jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "bannerCheckAdStatusForPlacementID:", placementId);
    },

    showAdInPosition(placementId: string, position: string): void {
        ATiOSJS.printJsLog(`ATiOSBannerJS::showAdInPosition(${placementId}, ${position})`);
        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "showBannerWithPlacementID:scene:position:", placementId, null, position);
    },

    showAdInPositionAndScenario(placementId: string, position: string, scenario: string): void {
        ATiOSJS.printJsLog(`ATiOSBannerJS::showAdInPositionAndScenario(${placementId}, ${position}, ${scenario})`);
        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "showBannerWithPlacementID:scene:position:", placementId, scenario, position);
    },

    showAdInRectangle(placementId: string, showAdRect: ShowAdRectangle): void {
        ATiOSJS.printJsLog(`ATiOSBannerJS::showAdInRectangle(${placementId}, ${JSON.stringify(showAdRect)})`);
        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "showBannerWithPlacementID:scene:rect:", placementId, null, showAdRect);
    },

    showAdInRectangleAndScenario(placementId: string, showAdRect: ShowAdRectangle, scenario: string): void {
        ATiOSJS.printJsLog(`ATiOSBannerJS::showAdInRectangleAndScenario(${placementId}, ${JSON.stringify(showAdRect)}, ${scenario})`);
        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "showBannerWithPlacementID:scene:rect:", placementId, scenario, showAdRect);
    },

    removeAd(placementId: string): void {
        ATiOSJS.printJsLog(`ATiOSBannerJS::removeAd(${placementId})`);
        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "removeAd:", placementId);
    },

    reShowAd(placementId: string): void {
        ATiOSJS.printJsLog(`ATiOSBannerJS::reShowAd(${placementId})`);
        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "reShowAd:", placementId);
    },

    hideAd(placementId: string): void {
        ATiOSJS.printJsLog(`ATiOSBannerJS::hideAd(${placementId})`);
        jsb.reflection.callStaticMethod(OC_WRAPPER_CLASS, "hideAd:", placementId);
    }
};

export default ATiOSBannerJS;
