//
//  HLAdBanner.h
//  HLAdsDemo
//
//  Created by Liubin on 2025/10/11.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@class HLAdBanner;

@protocol HLAdBannerDelegate <NSObject>

/// 广告开始加载
- (void)bannerAdDidStart:(HLAdBanner *)bannerAd;

/// 获取广告成功
- (void)bannerAdLoadSuccess:(UIView *)adView bannerAd:(HLAdBanner *)bannerAd;

/// 广告曝光回调
- (void)bannerAdWillVisible:(UIView *)adView bannerAd:(HLAdBanner *)bannerAd;

/// 获取广告失败
/// @param error 失败原因
- (void)bannerAdLoadFailed:(NSError*)error bannerAd:(HLAdBanner *)bannerAd;

/// 广告点击事件
/// @param adView 广告视图
- (void)bannerAdDidClick:(UIView *)adView bannerAd:(HLAdBanner *)bannerAd;

/// 广告关闭
/// @param adView 广告视图
- (void)bannerAdViewClosed:(UIView *)adView bannerAd:(HLAdBanner *)bannerAd;

/// deepLink 跳转app
- (void)bannerAdDidOpenApp:(HLAdBanner *)bannerAd;

/// 内置浏览器打开
- (void)bannerAdStartWebBrower:(HLAdBanner *)bannerAd;

/// 内置浏览器关闭
- (void)bannerAdWebBrowerDidClose:(HLAdBanner *)bannerAd;



@end

@interface HLAdBanner : UIView

@property (weak, nonatomic) id<HLAdBannerDelegate> delegate;

/// 处理广告行为的视图控制器
@property (weak, nonatomic) UIViewController * rootViewController;

/**
 * 初始化Banner广告
 * @param placementID 广告位ID，
 * @param adSize 广告尺寸
*/
- (instancetype)initWithPlacementID:(NSString *)placementID
                             adSize:(CGSize)adSize;

/// 加载广告
- (void)loadAd;

/// 广告ecmp，单位：分
- (CGFloat)adEcpm;

@end

NS_ASSUME_NONNULL_END
