//
//  LSBooster+RCTNativeModel.m
//  ReactLightspeedSDK
//
//  Created by marc matta on 11/26/16.
//  Copyright © 2016 com.lightspeed. All rights reserved.
//

#import "LSBooster+RCTNativeModel.h"
#import "LSAchievement+RCTNativeModel.h"
#import <React/RCTUtils.h>

@implementation LSBooster (RCTNativeModel)

- (NSDictionary *)reactNativeRepresentation {
    NSMutableArray *achievements;
    for (LSAchievement *achievement in self.achievements) {
        if (!achievements)
            achievements = [NSMutableArray array];
        
        [achievements addObject:[achievement reactNativeRepresentation]];
    }
    
    return @{@"achievements": RCTNullIfNil(achievements),
             @"panelistId": @(RCTZeroIfNaN(self.panelistId))
             };
}

@end
