#import "ContextAwareAdinCubeInterstitialDelegate.h"

#import "AdinCubeBannerImpl.h"

#define INTERSTITIAL_EVENT_PREFIX @"AIC-Interstitial-"

@implementation ContextAwareAdinCubeInterstitialDelegate

- (void)didCacheInterstitial {
	[self dispatchJavascriptEvent:INTERSTITIAL_EVENT_PREFIX @"onAdCached"];
}

- (void)didShowInterstitial {
	[[AdinCubeBannerImpl sharedBanner] onFullscreenAdShown:self.cdvPlugin.viewController];
	[self dispatchJavascriptEvent:INTERSTITIAL_EVENT_PREFIX @"onAdShown"];
}

- (void)didFailToShowInterstitial:(NSString*)errorCode {
	[[AdinCubeBannerImpl sharedBanner] onFullscreenAdHidden:self.cdvPlugin.viewController];
	[self dispatchJavascriptEvent:INTERSTITIAL_EVENT_PREFIX @"onError" content:errorCode];
}

- (void)didClickOnInterstitial {
	[self dispatchJavascriptEvent:INTERSTITIAL_EVENT_PREFIX @"onAdClicked"];
}

- (void)didHideInterstitial {
	[[AdinCubeBannerImpl sharedBanner] onFullscreenAdHidden:self.cdvPlugin.viewController];
	[self dispatchJavascriptEvent:INTERSTITIAL_EVENT_PREFIX @"onAdHidden"];
}

@end