//
//  ATBannerTool.h
//  anythink_sdk
//
//  Created by GUO PENG on 2021/7/12.
//

#import <Foundation/Foundation.h>

@class ATBannerView;

NS_ASSUME_NONNULL_BEGIN

@interface ATBannerTool : NSObject

#pragma mark - Utilities

/// Parse the flutter side parameters and get the rect of bannerView
+ (CGRect)getSizeFromExtraDic:(NSDictionary *)extraDic;

/// Get BannerView
+ (ATBannerView *)getBannerViewAdRect:(CGRect)rect placementID:(NSString *)placementID sceneID:(NSString * _Nullable)sceneID showCustomExt:(NSString * _Nullable)showCustomExt;


/// Whether banner ad is ready
+ (BOOL)bannerAdReady:(NSString *)placementID;

/// Get information about all available ads under the current ad slot. Supported by v5.7.53 and above.
+ (NSString *)getBannerValidAds:(NSString *)placementID;

/// Get placement status
+ (NSDictionary *)checkBannerLoadStatus:(NSString *)placementID;

/// Cache JS setShowConfig (scenarioId / showCustomExt) for use when Fabric attach
+ (void)setShowConfigMap:(NSDictionary *)map forPlacementID:(NSString *)placementID;

/// Cache JS setLocalExtra, used when retrieving Banner
+ (void)setLocalExtraMap:(NSDictionary *)map forPlacementID:(NSString *)placementID;

+ (NSDictionary *)localExtraForPlacementID:(NSString *)placementID;

+ (NSString *)showCustomExtForPlacementID:(NSString *)placementID;

+ (NSString *)scenarioIdForPlacementID:(NSString *)placementID;

/// Record the size used by the command load for Fabric to verify whether it is consistent with the show size when attaching
+ (void)setLoadedSize:(CGSize)size forPlacementID:(NSString *)placementID;
+ (CGSize)loadedSizeForPlacementID:(NSString *)placementID;

+ (CGSize)sdkBannerSizeForPlacementID:(NSString *)placementID;

+ (BOOL)isBannerSize:(CGSize)a closeTo:(CGSize)b;

+ (void)clearPlacementState:(NSString *)placementID;

@end

NS_ASSUME_NONNULL_END
