#import <UIKit/UIKit.h>
#if __has_include(<TencentQianWebView/TQWebViewConfig.h>)
#import <TencentQianWebView/TQWebViewConfig.h>
#else
#import "TQWebViewConfig.h"
#endif
#if __has_include(<TencentQianWebView/TQSignCallbacks.h>)
#import <TencentQianWebView/TQSignCallbacks.h>
#else
#import "TQSignCallbacks.h"
#endif

NS_ASSUME_NONNULL_BEGIN

/// **容器模式** SDK 顶层入口。
///
/// **典型用法**:
/// ```objc
/// [TQWebView openFromPresenter:self
///                          url:signUrl
///                       config:[TQWebViewConfig defaultConfig]
///                    callbacks:[TQSignCallbacks callbacksWithOnSignResult:^(TQSignResult *r) {
///                        // ...
///                    } onEvent:nil]
///                     animated:YES
///                   completion:nil];
/// ```
@interface TQWebView : NSObject

/// SDK 版本号。
@property (class, nonatomic, copy, readonly) NSString *sdkVersion;

/// 启动签署容器(modal present)。
+ (void)openFromPresenter:(UIViewController *)presenter
                      url:(NSString *)url
                   config:(nullable TQWebViewConfig *)config
                callbacks:(nullable TQSignCallbacks *)callbacks
                 animated:(BOOL)animated
               completion:(void (^_Nullable)(void))completion;

/// 启动「自检页」容器,验证客户 App 内 WebView 是否满足电子签 H5 兼容要求。
/// `customUrl` 为 nil 时走 SDK 默认 URL(SDK 默认 beta 环境,兼容性测试无需切生产)。
+ (void)openCompatibilityTestFromPresenter:(UIViewController *)presenter
                                  customUrl:(nullable NSString *)customUrl
                                     config:(nullable TQWebViewConfig *)config
                                  callbacks:(nullable TQSignCallbacks *)callbacks
                                   animated:(BOOL)animated;

/// 工具方法:判断 URL 是否 SDK 应当处理。
+ (BOOL)canHandleURL:(nullable NSURL *)url;

@end

NS_ASSUME_NONNULL_END
