//
//  LSUpdateProfileRequest+RCTNativeModel.m
//  ReactLightspeedSDK
//
//  Created by marc matta on 3/2/17.
//  Copyright © 2017 com.lightspeed. All rights reserved.
//

#import "RCTConvert+LSUpdateProfileRequest.h"
#import "RCTLSUtils.h"

@implementation RCTConvert (LSUpdateProfileRequest)
+ (LSUpdateProfileRequest *)LSUpdateProfileRequest:(id)json
{
    NSDictionary *data = [RCTConvert NSDictionary:json];
    
    if (data.count == 0) { return nil; }
    
    LSUpdateProfileRequest *request = [LSUpdateProfileRequest new];
    for (NSString *key in data) {
        [request setValue:data[key] forKey:key];
    }
    
    return request;
}
@end

@implementation LSUpdateProfileRequest (KVC)

// This will prevent the application from crashing if an undefined key is sent from React
- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
#if DEBUG
    NSLog(@"Sending Undefined Key for UpdateProfileRequest: %@", key);
#endif
}

@end
