//
//  WPLuxADManager.h
//  TallPaper
//
//  Created by aaa on 2024/7/25.
//

#import <Foundation/Foundation.h>
#import <AppLovinSDK/AppLovinSDK.h>
#import "LuxADSuperVC.h"
NS_ASSUME_NONNULL_BEGIN

typedef void(^LuxADManagerCallback)(NSInteger actionType);//actionType,1表示未获取AD而关闭广告;2,表示获取到了AD而关闭广告;
typedef void (^LuxADManagerActionBlock)(UIViewController *vc);//用于补量模式的跳转vc 的action

#pragma mark ------LuxADManagerItem

@protocol LuxADManagerInterstitialItemDelegate <NSObject>

- (void)needLoadADWithNum:(NSInteger)num;

@end
@interface LuxADManagerInterstitialItem : NSObject
@property (nonatomic,strong) MAInterstitialAd *adItem;
@property (nonatomic) NSInteger retryAttemptCount;
@property (nonatomic,strong) NSDate *lastShowADDate;//ad间隔时长
@property (nonatomic,strong) NSString *adId;
@property (nonatomic,weak) id<LuxADManagerInterstitialItemDelegate> delegate;
@property (nonatomic,weak) LuxADManagerActionBlock actionBlock;//在补量模式下,跳转至目的页面

@property (nonatomic,strong) NSNumber *ecpm;//记录第一次load成功之后的ecpm的值
@property (nonatomic) NSNumber *tapPointX;
@property (nonatomic) NSNumber *tapPointY;
+ (LuxADManagerInterstitialItem *)initWithAdId:(NSString *)adId adDelegate:(id<MAAdDelegate>)adDelegate actionBlock:(LuxADManagerActionBlock)actionBlock;
@end

#pragma mark ------LuxADManager


@interface LuxADManager : NSObject
+ (instancetype)shareInstance;

//第一步: 通过指定的ids数组初始化所有 插屏  ad  ,注意,仅是插屏
- (void)addADWithInterstitialId:(NSString*)id actionBlock:(LuxADManagerActionBlock)block;

//第二步: 初始化广告
- (void)configureADWithAppLovinSDKKey:(NSString *)appLovinSDKKey;

//用于在启动app时,即第一次在appDidFinishLanuch调用开屏广告
- (void)showFirstOpenAD:(LuxADManagerCallback)callback window:(UIWindow *)window bgImgName:(NSString *)bgImgName bgColor:(UIColor *)bgColor;

//用于在app进行前后台切换时调用
- (void)showOpenAD;



//随机展示_adItemsArr中的插屏ad
- (void)showADByRandomModeWithCallback:(LuxADManagerCallback)callback;





#pragma mark --------主要用于AD补量
//返回所有的插屏ad(非开屏广告openad)
- (NSArray <LuxADManagerInterstitialItem *> *)allInterstitialAds;

//根据指定的在_adItemsArr中的index展示插屏ad
- (void)showADWithIndex:(NSInteger)index callback:(LuxADManagerCallback)callback ;

//判断当前是否为广告不量模式
- (BOOL)isADSSMode;


+ (void)configureSecureClick:(UIView *)view;
@end

NS_ASSUME_NONNULL_END
