#import "InAppMrecBannerViewController.h"
#import "AdViewDemoMacros.h"

NSString * const storedImpMrecBannerInApp = @"POSIDcsts715vz17x";

@interface InAppMrecBannerViewController ()

@property (nonatomic) ADVIEW_BannerView * adviewBannerView;

@end

@implementation InAppMrecBannerViewController

- (void)loadView {
    [super loadView];
    [self createAd];
}

- (void)createAd {
    self.adviewBannerView = [[ADVIEW_BannerView alloc] initWithFrame:CGRectMake(0, 0, self.adSize.width, self.adSize.height) configID:storedImpMrecBannerInApp adSize:self.adSize];

    self.adviewBannerView.delegate = self;
    self.adviewBannerView.adFormat = ADVIEW_AdFormat.banner;
    self.adviewBannerView.videoParameters.placement = ADVIEW_Placement.InBanner;

    self.bannerView.backgroundColor = [UIColor clearColor];
    [self.bannerView addSubview:self.adviewBannerView];

    [self.adviewBannerView loadAd];
}

- (UIViewController *)bannerViewPresentationController {
    return self;
}

- (void)bannerView:(ADVIEW_BannerView *)bannerView didFailToReceiveAdWith:(NSError *)error {
    AdViewDemoLogError(@"%@", error.localizedDescription);
}

@end
