//
//  HLAdUnifiedNative.h
//  HLAd
//
//  Created by Liubin on 2024/3/11.
//

#import <Foundation/Foundation.h>

@class HLAdUnifiedMaterial, HLAdUnifiedNative;

NS_ASSUME_NONNULL_BEGIN

@protocol HLAdUnifiedNativeDelegate <NSObject>

/// 获取native广告成功
- (void)unifiedNativeAdLoadSuccess:(HLAdUnifiedNative *)unifiedNativeAd;

/// native广告曝光回调
- (void)unifiedNativeAdWillVisible:(HLAdUnifiedNative *)unifiedNativeAd;

/// 获取native广告失败
/// @param error 失败原因
- (void)unifiedNativeAd:(HLAdUnifiedNative *)unifiedNativeAd loadFailed:(NSError*)error;

/// native广告点击事件
/// @param adView 广告视图
- (void)unifiedNativeAdDidClick:(HLAdUnifiedNative *)unifiedNativeAd adView:(UIView *)adView;

/// deepLink 跳转app
- (void)unifiedNativeAdDidOpenApp:(HLAdUnifiedNative *)unifiedNativeAd;

/// native内置浏览器打开
- (void)unifiedNativeAdStartWebBrower:(HLAdUnifiedNative *)unifiedNativeAd;

/// native内置浏览器关闭
- (void)unifiedNativeAdWebBrowerDidClose:(HLAdUnifiedNative *)unifiedNativeAd;


@end

@interface HLAdUnifiedNative : NSObject

/// 广告数据
@property (nonatomic, strong, readonly, nullable) HLAdUnifiedMaterial *adMaterial;
/// 委托
@property (nonatomic, weak, nullable) id<HLAdUnifiedNativeDelegate> delegate;
/// 处理广告行为的视图控制器
@property (weak, nonatomic) UIViewController * rootViewController;

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

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

/**
 在原生广告视图中注册可点击的视图
 @param containerView : required.
 原生广告的容器视图
 @param clickableViews : optional.
 可单击的视图数组.
 */
- (void)registerContainer:(__kindof UIView *)containerView withClickableViews:(NSArray<__kindof UIView *> *_Nullable)clickableViews;



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

@end


NS_ASSUME_NONNULL_END
