//
//  HLAdRewardVideo.h
//  ULinkAd
//
//  Created by Zhuanz on 2026/1/14.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@class HLAdRewardVideo;

@protocol HLAdRewardedVideoAdDelegate <NSObject>

/**
 广告数据开始加载回调

 @param rewardedVideoAd HLAdRewardVideo 实例
 */
- (void)rewardVideoAdDidLoad:(HLAdRewardVideo *)rewardedVideoAd;

/**
 广告数据加载成功回调

 @param rewardedVideoAd HLAdRewardVideo 实例
 */
- (void)rewardVideoAdDataDidLoad:(HLAdRewardVideo *)rewardedVideoAd;

/**
 视频数据下载成功回调，收到此回调后广告才能开始展示，否则资源是未下载完成的

 @param rewardedVideoAd HLAdRewardVideo 实例
 */
- (void)rewardVideoAdVideoLoadFinish:(HLAdRewardVideo *)rewardedVideoAd;

/**
 视频广告曝光回调

 @param rewardedVideoAd HLAdRewardVideo 实例
 */
- (void)rewardVideoAdDidShow:(HLAdRewardVideo *)rewardedVideoAd;

/**
 视频播放页关闭回调

 @param rewardedVideoAd HLAdRewardVideo 实例
 */
- (void)rewardVideoAdDidClose:(HLAdRewardVideo *)rewardedVideoAd;

/**
 视频广告信息点击回调

 @param rewardedVideoAd HLAdRewardVideo 实例
 */
- (void)rewardVideoAdDidClicked:(HLAdRewardVideo *)rewardedVideoAd;

/**
 视频广告各种错误信息回调

 @param rewardedVideoAd HLAdRewardVideo 实例
 @param error 具体错误信息
 */
- (void)rewardVideoAd:(HLAdRewardVideo *)rewardedVideoAd didFailWithError:(NSError *)error;


/**
 视频广告播放达到激励条件回调

 @param rewardedVideoAd HLAdRewardVideo 实例
 @param info 可能包含广告的一些信息，默认为空
 */
- (void)rewardVideoAdDidRewardEffective:(HLAdRewardVideo *)rewardedVideoAd info:(NSDictionary *)info;

/**
 视频广告视频播放完成

 @param rewardedVideoAd HLAdRewardVideo 实例
 */
- (void)rewardVideoAdDidPlayFinish:(HLAdRewardVideo *)rewardedVideoAd;

/// 内置浏览器打开
- (void)rewardVideoAdStartWebBrower:(HLAdRewardVideo *)rewardedVideoAd;

/// 内置浏览器关闭
- (void)rewardVideoAdWebBrowerDidClose:(HLAdRewardVideo *)rewardedVideoAd;

/// deeplink跳转App
- (void)rewardVideoAdViewDidOpenApp:(HLAdRewardVideo *)rewardedVideoAd;

@end

@interface HLAdRewardVideo : UIView


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

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

/**
 *  激励视频广告的展示存在有效期，单次检索后须在一定时间内展示在页面上
 *  返回本地是否有可用广告    YES代表本地有缓存成功且未过期的广告，NO代表不可用
 */
- (BOOL)isReady;

/**
 * 加载广告，不展示
 */
- (void)loadAd;

/**
 * 展示广告
 * @param viewController : 必须传入用于显示插屏广告的UIViewController
*/
- (void)showWithViewController:(UIViewController *)viewController;



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


@end

NS_ASSUME_NONNULL_END
