//
//  RCTConvert+LSCountryLanguages.m
//  ReactLightspeedSDK
//
//  Created by marc matta on 11/24/17.
//  Copyright © 2017 com.lightspeed. All rights reserved.
//

#import "LSCountryLanguages+RCTNativeModel.h"
#import "LSCountryLanguageSet+RCTNativeModel.h"
#import <React/RCTUtils.h>

@implementation LSCountryLanguages (RCTNativeModel)
- (NSDictionary *)reactNativeRepresentation {
    NSMutableArray *cSupported;
    for (LSCountryLanguageSet *supported in self.currentlySupported) {
        if (!cSupported)
            cSupported = [NSMutableArray array];
        
        [cSupported addObject:[supported reactNativeRepresentation]];
    }
    
    NSMutableArray *lSupported;
    for (LSCountryLanguageSet *supported in self.laterSupported) {
        if (!lSupported)
            lSupported = [NSMutableArray array];
        
        [lSupported addObject:[supported reactNativeRepresentation]];
    }
    
    return @{@"currentlySupported": RCTNullIfNil(cSupported),
             @"laterSupported": RCTNullIfNil(lSupported)
             };
}
@end
