#import "RCTNativeFairplayModule.h"
#import "react_native_prestoplay-Swift.h"

@interface RCTNativeFairplayModule ()
@property (nonatomic, strong) RCTNativeFairplayModuleSwift *instance;
@end

@implementation RCTNativeFairplayModule
+ (NSString *)moduleName {
    return @"NativeFairplayModule";
}

- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
    return std::make_shared<facebook::react::NativeFairplayModuleSpecJSI>(params);
}

- (void)initialize {
    self.instance = [[RCTNativeFairplayModuleSwift alloc] init];
}

- (void)completeKey:(nonnull NSString *)completerId contentId:(nonnull NSString *)contentId resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject { 
    [self.instance completeKey:completerId contentId:contentId resolve:^(){ resolve(nil); } reject:^(NSString* prestoPlayErrorJson){ reject(nil, prestoPlayErrorJson, nil);}];
}

@end

