//
//  UnifiedBiddingPresenter.swift
//  sdk-demo-ios
//
//  Created by Smaato Inc on 03/03/2019.
//  Copyright © 2019 Smaato Inc. All rights reserved.
//

import Foundation
import MoPub
import GoogleMobileAds

//Get from Smaato SPX
let smaatoUBBannerAdSpaceId_320x50 = "130563103"
let smaatoUBBannerAdSpaceId_300x250 = "130619168"
let smaatoUBBannerAdSpaceId_728x90 = "130620582"
let smaatoUBInterstitialAdSpaceId = "130560861"
let smaatoUBRewardedAdSpaceId = "130560861"
//Get from Mopub Dashboard
let mopubBannerAdUnitId_320x50 = "5cd3496c673143a7a7a6a064b50ed440"
let mopubBannerAdUnitId_300x250 = "ec2e476c4d244660a1e12ab3385b1237"
let mopubBannerAdUnitId_728x90 = "6dd0da2e78a84056874e793890899015"
let mopubIntrestitialAdUnitId = "9e92c0d5c51a48e8bd6e021a207d4653"
let mopubRewardedAdUnitId = "34a47404e7be4835829994d2c4960507"

@objc class UnifiedBiddingPresenter: NSObject {
    let mopubUBModels: [MopubUBModel]!
    
    override init() {
        var models = [
            MopubUBModel(moPubsize: .bannerSize,
                         adType: .Banner,
                         adUnitId: mopubBannerAdUnitId_320x50,
                         name: "Banner 320 x 50",
                         smaatoAdspaceId: smaatoUBBannerAdSpaceId_320x50),
            MopubUBModel(moPubsize: .medRectSize,
                         adType: .Banner,
                         adUnitId: mopubBannerAdUnitId_300x250,
                         name: "Banner 300 x 250",
                         smaatoAdspaceId: smaatoUBBannerAdSpaceId_300x250),
            MopubUBModel(moPubsize: nil,
                         adType: .Interstitial,
                         adUnitId: mopubIntrestitialAdUnitId,
                         name: "Interstitial",
                         smaatoAdspaceId: smaatoUBInterstitialAdSpaceId),
            MopubUBModel(moPubsize: nil,
                         adType: .Rewarded,
                         adUnitId: mopubRewardedAdUnitId,
                         name: "Rewarded",
                         smaatoAdspaceId: smaatoUBRewardedAdSpaceId)
        ]
        
        if UI_USER_INTERFACE_IDIOM() == .pad {
            let iPadSizeBanner =  MopubUBModel(moPubsize: .leaderBoardSize,
                                               adType: .Banner,
                                               adUnitId: mopubBannerAdUnitId_728x90,
                                               name: "Banner 728 x 90",     
                                               smaatoAdspaceId: smaatoUBBannerAdSpaceId_728x90)
            models.insert(iPadSizeBanner, at: 2)
        }
        
        mopubUBModels = models
        super.init()
    }
}

