//
//  HLAdNative.h
//  HLAd
//
//  Created by Liubin on 2022/9/14.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@class HLAdNative;

@protocol HLAdNativeDelegate <NSObject>


/// native广告开始加载
- (void)nativeAdDidStart:(HLAdNative *)nativeAd;

/// 获取native广告成功
- (void)nativeAdLoadSuccess:(UIView *)adView nativeAd:(HLAdNative *)nativeAd;

/// native广告曝光回调
- (void)nativeAdWillVisible:(UIView *)adView nativeAd:(HLAdNative *)nativeAd;

/// 获取native广告失败
/// @param error 失败原因
- (void)nativeAdLoadFailed:(NSError*)error nativeAd:(HLAdNative *)nativeAd;

/// native广告点击事件
/// @param adView 广告视图
- (void)nativeAdDidClick:(UIView *)adView nativeAd:(HLAdNative *)nativeAd;

/// native广告关闭
/// @param adView 广告视图
- (void)nativeAdViewClosed:(UIView *)adView nativeAd:(HLAdNative *)nativeAd;

/// deepLink 跳转app
- (void)nativeAdDidOpenApp:(HLAdNative *)nativeAd;

/// native内置浏览器打开
- (void)nativeAdStartWebBrower:(HLAdNative *)nativeAd;

/// native内置浏览器关闭
- (void)nativeAdWebBrowerDidClose:(HLAdNative *)nativeAd;

@end



@interface HLAdNative : UIView


@property (weak, nonatomic) id<HLAdNativeDelegate> delegate;
/// 处理广告行为的视图控制器
@property (weak, nonatomic) UIViewController * rootViewController;
/// 手动设置广告内容的边距（可选）
@property (nonatomic, assign) CGFloat edge;

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

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

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

@end




NS_ASSUME_NONNULL_END
