//
//  SmaatoSDK+UnifiedBidding.h
//  SmaatoSDKUnifiedBidding
//
//  Created by Denisia Enasescu on 28/01/2019.
//  Copyright © 2019 Siarhei Barmotska. All rights reserved.
//

#import <SmaatoSDKCore/SmaatoSDKCore.h>

/**
 Banner sizes supported in the SDK
 */
typedef NS_ENUM(NSUInteger, SMAUbBannerSize) {
    /**  XXLarge (320x50) banner*/
    kSMAUbBannerSizeXXLarge_320x50 = 0,
    /** Medium Rectangle (300*250) banner */
    kSMAUbBannerSizeMediumRectangle_300x250,
    /** Skyscraper (120x600) banner*/
    kSMAUbBannerSizeSkyscraper_120x600,
    /** Leaderboard (728x90) banner*/
    kSMAUbBannerSizeLeaderboard_728x90
};

@interface SMAUbBid : NSObject
/**
 Adjusted bid price on the base of the chosen granularity of ad displaying
 */
@property (nonatomic, readonly) CGFloat bidPrice;

/**
 Optional helper method builds keyword for Mopub LineItem in a format "smaato_cpm:X.XX", where X.XX is adjusted bid price for LineItem.
 A publisher can use bidPrice to create own Prebid (target) keyword for Mopub.
 */
@property (nonatomic, copy, readonly, nonnull) NSString *mopubPrebidKeyword;

+ (null_unspecified instancetype) new NS_UNAVAILABLE;
- (null_unspecified instancetype)init NS_UNAVAILABLE;

@end

@interface SmaatoSDK (UnifiedBidding)

/**
 The method activates the SmaatoSDK Unified Bidding module
 Unified Bidding module is optional and functions when SmaatoSDK is included as secondary with all required adapters.

 @warning This method must be called once
 @param publisherId Publisher identifier assigned by Smaato. Must not be \c nil.
 */
+ (void)enableUnifiedBiddingWithPublisherId:(NSString *_Nonnull)publisherId;

/**
 The method sends prebid request for Banner Smaato ads

 @param adSpaceId       AdspaceId identifier assigned by Smaato. Unified Bidding support should be enabled for this AdspaceId in Smaato SPX.
                        Must not be \c nil
 @param bannerSize      The banner size to be returned. see \c SMAUbBannerSize
 @param completion      Callback is invoked, when prebid response processing has been finished.
                        `bid` or `error` values reflect state of Prebid request. Must not be \c nil.
 */
+ (void)prebidBannerForAdSpaceId:(NSString *_Nonnull)adSpaceId
                      bannerSize:(SMAUbBannerSize)bannerSize
                      completion:(void (^_Nonnull)(SMAUbBid *_Nullable bid, NSError *_Nullable error))completion;

/**
 The method sends prebid request for Interstitial Smaato ads

 @param adSpaceId       AdspaceId identifier assigned by Smaato. Unified Bidding support should be enabled for this AdspaceId in Smaato SPX.
                        Must not be \c nil
 @param completion      Callback is invoked, when prebid response processing has been finished.
                        `bid` or `error` values reflect state of Prebid request. Must not be \c nil.
 */
+ (void)prebidInterstitialForAdSpaceId:(NSString *_Nonnull)adSpaceId
                            completion:(void (^_Nonnull)(SMAUbBid *_Nullable bid, NSError *_Nullable error))completion;

/**
 The method sends prebid request for Rewarded Interstitial Smaato ads

 @param adSpaceId       AdspaceId identifier assigned by Smaato. Unified Bidding support should be enabled for this AdspaceId in Smaato SPX.
                        Must not be \c nil
 @param completion      Callback is invoked, when prebid response processing has been finished.
                        `bid` or `error` values reflect state of Prebid request. Must not be \c nil.
 */
+ (void)prebidRewardedInterstitialForAdSpaceId:(NSString *_Nonnull)adSpaceId
                                    completion:(void (^_Nonnull)(SMAUbBid *_Nullable bid, NSError *_Nullable error))completion;

@end
