#import "RNProxyDelegate.h"

@implementation RNProxyDelegate {
    RCTPromiseResolveBlock resolveBlock;
    RCTPromiseRejectBlock rejectBlock;
}

- (instancetype)initWithResolveBlock:(RCTPromiseResolveBlock)resolve andRejectBlock:(RCTPromiseRejectBlock)reject {
    self = [super init];
    if (self) {
        resolveBlock = resolve;
        rejectBlock = reject;
    }
    return self;
}

- (void)didRejectPromise:(SBErrorResponse * _Nonnull)error {
    rejectBlock([@(error.code) stringValue], error.message, nil);
}

- (void)didResolvePromise:(id _Nullable)result { 
    resolveBlock(result);
}

@end
