#import "TQWebViewConfig.h"

@implementation TQWebViewConfig

- (instancetype)init {
    if (self = [super init]) {
        _showTopBar = YES;
        _topBarTitle = @"";
        _topBarBackgroundColor = nil;
        _topBarTextColor = nil;
        _showCloseButton = YES;
        _statusBarStyle = TQStatusBarStyleDarkContent;
        _injectUserAgent = YES;
        _userAgentExtra = @"";
        _confirmBeforeClose = NO;
        _confirmCloseTitle = @"";
        _confirmCloseMessage = @"";
        _externalSchemes = @[ @"weixin", @"alipays" ];
        _downloadWithCookies = NO;
        _compatibilityTestUrl = nil;
    }
    return self;
}

+ (instancetype)defaultConfig {
    return [[TQWebViewConfig alloc] init];
}

+ (NSString *)defaultCompatibilityTestUrl {
    return @"https://quick.beta.qian.tencent.cn/compatibilityTest";
}

#pragma mark - NSCopying

- (id)copyWithZone:(NSZone *)zone {
    TQWebViewConfig *c = [[TQWebViewConfig allocWithZone:zone] init];
    c.showTopBar = _showTopBar;
    c.topBarTitle = [_topBarTitle copy];
    c.topBarBackgroundColor = _topBarBackgroundColor;
    c.topBarTextColor = _topBarTextColor;
    c.showCloseButton = _showCloseButton;
    c.statusBarStyle = _statusBarStyle;
    c.injectUserAgent = _injectUserAgent;
    c.userAgentExtra = [_userAgentExtra copy];
    c.confirmBeforeClose = _confirmBeforeClose;
    c.confirmCloseTitle = [_confirmCloseTitle copy];
    c.confirmCloseMessage = [_confirmCloseMessage copy];
    c.externalSchemes = [_externalSchemes copy];
    c.downloadWithCookies = _downloadWithCookies;
    c.compatibilityTestUrl = [_compatibilityTestUrl copy];
    return c;
}

@end
