#import "RNDebugLibs.h"

#ifdef DEBUG
#import "FLEXManager.h"
#import <DoraemonKit/DoraemonManager.h>
#endif

@implementation RNDebugLibs

// Export the module
RCT_EXPORT_MODULE();

RCT_EXPORT_METHOD(showExplorer)
{
#ifdef DEBUG
    dispatch_async(dispatch_get_main_queue(), ^{
        [[FLEXManager sharedManager] showExplorer];
    });
#else
    NSLog(@"[RNDebugLibs] showExplorer is only available in DEBUG builds");
#endif
}

RCT_EXPORT_METHOD(hideExplorer)
{
#ifdef DEBUG
    dispatch_async(dispatch_get_main_queue(), ^{
        [[FLEXManager sharedManager] hideExplorer];
    });
#else
    NSLog(@"[RNDebugLibs] hideExplorer is only available in DEBUG builds");
#endif
}

RCT_EXPORT_METHOD(toggleExplorer)
{
#ifdef DEBUG
    dispatch_async(dispatch_get_main_queue(), ^{
        [[FLEXManager sharedManager] toggleExplorer];
    });
#else
    NSLog(@"[RNDebugLibs] toggleExplorer is only available in DEBUG builds");
#endif
}

RCT_EXPORT_METHOD(installDoraemonKit:(NSString *)productId)
{
#ifdef DEBUG
    dispatch_async(dispatch_get_main_queue(), ^{
        [[DoraemonManager shareInstance] installWithPid:productId];
    });
#else
    NSLog(@"[RNDebugLibs] installDoraemonKit is only available in DEBUG builds");
#endif
}

RCT_EXPORT_METHOD(showDoraemonKit)
{
#ifdef DEBUG
    dispatch_async(dispatch_get_main_queue(), ^{
        [[DoraemonManager shareInstance] showDoraemon];
    });
#else
    NSLog(@"[RNDebugLibs] showDoraemonKit is only available in DEBUG builds");
#endif
}

RCT_EXPORT_METHOD(hideDoraemonKit)
{
#ifdef DEBUG
    dispatch_async(dispatch_get_main_queue(), ^{
        [[DoraemonManager shareInstance] hiddenDoraemon];
    });
#else
    NSLog(@"[RNDebugLibs] hideDoraemonKit is only available in DEBUG builds");
#endif
}

@end 