// ContentsquareInterfaceWrapperLegacy.m
#import <Foundation/Foundation.h>
#import <React/RCTUIManager.h>
#import <React/RCTBridgeModule.h>
#import "ContentsquareInterfaceWrapperLegacy.h"

#if __has_include("ContentsquareBridgeModule-Swift.h")
#import "ContentsquareBridgeModule-Swift.h"
#elif __has_include("ContentsquareBridgeModule/ContentsquareBridgeModule-Swift.h")
#import "ContentsquareBridgeModule/ContentsquareBridgeModule-Swift.h"
#endif

@implementation ContentsquareInterfaceWrapperLegacy {
    __strong ContentsquareSDKInterfaceLegacy *sdkInterface;
    BOOL csqEnabled;
}

- (instancetype)init {
    self = [super init];
    if (self) {

        sdkInterface = [[ContentsquareSDKInterfaceLegacy alloc] init];

    }
    return self;
}

- (void)resumeTracking {
    [sdkInterface resumeTracking];
}

- (void)stopTracking {
    [sdkInterface stopTracking];
}

- (void)start {
    [sdkInterface start];
}

- (void)optIn {
    [sdkInterface optIn];
}

- (void)optOut {
    [sdkInterface optOut];
}

- (void)handleWithUrl:(NSURL *)url {
    [sdkInterface handleWithUrl:url];
}

- (void)sendWithScreenViewWithName:(NSString *)name cvars:(NSArray *)cvars {
    [sdkInterface sendWithScreenViewWithName:name cvars:cvars];
}


- (void)getUserId:(RCTResponseSenderBlock)callback {
    NSString *userID = sdkInterface.userID;
    if (userID) {
        callback(@[userID]);
    } else {
        callback(nil);
    }
}

- (void)sendTransactionWithIntCurrency:(NSString *)identifier
                                 value:(float)value
                              currency:(NSInteger)currency {
    [sdkInterface sendWithTransactionId:identifier
                                  value:value
                               currency:currency];
}

- (void)initComponentsWithParams:(NSDictionary *)params
{
    [sdkInterface initComponentsWithParams:params];
}

- (void)sendTransactionWithStringCurrency:(NSString *)identifier
                                    value:(float)value
                                 currency:(NSString*)currency {
    [sdkInterface sendWithTransactionId:identifier
                                  value:value
                         stringCurrency:currency];
}

- (void)sendDynamicStringVar:(NSString *)key
                       value:(NSString *)value {
    [sdkInterface sendWithDynamicVar:key stringValue:value];
}

- (void)sendDynamicIntVar:(NSString *)key
                    value:(NSInteger)value {
    [sdkInterface sendWithDynamicVar:key intValue:(UInt32) value];
}

- (void)setDefaultMaskingWithIsMasking:(BOOL)isMasking {
    [sdkInterface setDefaultMaskingWithIsMasking:isMasking];
}

- (void)sendUserIdentifier:(NSString *)userIdentifier {
    [sdkInterface sendUserIdentifier:userIdentifier];
}

- (void)setOnSessionReplayLinkChange {
    [sdkInterface setOnSessionReplayLinkChange];
}

- (void)monitorWarn:(NSDictionary *)params {
    [sdkInterface monitorWarn:params];
}

- (void)monitorError:(NSDictionary *)params {
    [sdkInterface monitorError:params];
}

- (void)injectWebView:(NSNumber *)webViewTag
in:(RCTUIManager *)uimanager {
    [sdkInterface injectWebViewWithTag:webViewTag in:uimanager];
}

- (void)removeInjectionInWebView:(NSNumber *)webViewTag
in:(RCTUIManager *)uimanager {
    [sdkInterface removeInjectionInWebViewWithTag:webViewTag in:uimanager];
}

- (void)configureProductAnalyticsWithEnvironmentID:(NSString *)environmentID additionalOptions:(NSDictionary *)productAnalyticsOptions {
    // No-op: Product Analytics not available in legacy SDK
    NSLog(@"CSLIB: configureProductAnalytics is not available in legacy SDK mode");
}

- (void)addDynamicIntVar:(NSString *)key value:(NSInteger)value {
    // no-op
}


- (void)addDynamicStringVar:(NSString *)key value:(NSString *)value {
    // no-op
}


- (void)identify:(NSString *)identity {
    // no-op
}


- (void)pauseTracking {
    // no-op
}


- (void)registerWebView:(NSNumber *)webViewTag in:(RCTUIManager *)uiManager {
    // no-op
}


- (void)resetIdentity {
    // no-op
}


- (void)stop {
    // no-op
}


- (void)trackEventWithName:(NSString *)event properties:(NSDictionary *)properties {
    // no-op
}


- (void)trackScreenviewWithName:(NSString *)name cvars:(NSArray *)cvars {
    // no-op
}


- (void)trackTransactionWithIntCurrency:(NSString *)identifier value:(float)value currency:(NSInteger)currency {
    // no-op
}


- (void)trackTransactionWithStringCurrency:(NSString *)identifier value:(float)value currency:(NSString *)currency {
    // no-op
}


- (void)unregisterWebView:(NSNumber *)webViewTag from:(RCTUIManager *)uiManager {
    // no-op
}

- (void)addEventProperties:(NSDictionary *)properties {
    // no-op
}

- (void)removeEventProperty:(NSString *)key {
    // no-op
}

- (void)clearEventProperties {
    // no-op
}

- (void)setURLMaskingPatterns:(NSArray<NSString *> *)patterns {
    // no-op
}

- (void)triggerNativeCrash {
    // no-op
}

- (void)addUserProperties:(NSDictionary *)properties {
    // no-op
}

- (void)setOnMetadataChange {
    // no-op
}

@end
