//
//  ATNativeManager.h
//  topon_flutter_plugin
//
//  Created by GUO PENG on 2021/6/29.
//

#import <Foundation/Foundation.h>
#import <AnyThinkSDK/AnyThinkSDK.h>

@class ATNativeUIComponent;

NS_ASSUME_NONNULL_BEGIN

@interface ATNativeManager : NSObject

/// All apps share the same ATNativeManager instance - it is also the SDK loaded delegate (loadADWithplacementID:delegate:)
/// and display the receiver of delegate (ATNativeADConfiguration.delegate). UIComponent must use this sharedManager
/// Get config, otherwise config.delegate=nil → all callbacks such as display/click/video will be lost.
+ (instancetype)sharedManager;

/// Construct ATNativeADConfiguration with delegate=self (for UIComponent to be called in attachIfNeeded).
- (ATNativeADConfiguration *)getATNativeADConfiguration:(NSDictionary *)extraDic
                                       isAdaptiveHeight:(BOOL)isAdaptiveHeight;

/// Load native ad
- (void)loadNativeWith:(NSString *)placementID extraDic:(NSDictionary *)extraDic;

/// Show native ad
- (void)showNative:(NSString *)placementID isAdaptiveHeight:(BOOL)isAdaptiveHeight extraDic:(NSDictionary *) extraDic;

/// Display scene native ads
- (void)showNative:(NSString *)placementID sceneID:(NSString *)sceneID isAdaptiveHeight:(BOOL)isAdaptiveHeight extraDic:(NSDictionary *) extraDic;

/// Display scene native advertising with showCustomExt
- (void)showNative:(NSString *)placementID sceneID:(NSString *)sceneID showCustomExt:(NSString *)showCustomExt isAdaptiveHeight:(BOOL)isAdaptiveHeight extraDic:(NSDictionary *)extraDic;

/// Get placement status
- (NSDictionary *)checkNativeLoadStatus:(NSString *)placementID;

/// Remove native ad
- (void)removeNative:(NSString *)placementID;

/// Destroy native ads (adId empty → destroy in whole)
- (void)destroyNativeAd:(NSString *)placementID adId:(NSString *)adId;

/// Destroy ATNativeADView (SDK destroyNative reflection call)
- (void)destroyNativeAdViewIfNeeded:(ATNativeADView *)adView;

/// Fabric path: UIComponent is registered when attaching, and is destroyed according to adView positioning when closing the callback.
- (void)registerFabricUIComponent:(ATNativeUIComponent *)component
                  forNativeADView:(ATNativeADView *)adView;
- (void)unregisterFabricUIComponentForNativeADView:(ATNativeADView *)adView;
- (void)destroyFabricNativeADView:(ATNativeADView *)adView;

/// Report scenario entry rate
- (void)entryScenarioWithPlacementID:(NSString *)placementID sceneID:(NSString *)sceneID;

/// Whether ad is ready
- (BOOL)hasNativeAdReady:(NSString *)placementID;


@end

NS_ASSUME_NONNULL_END
