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

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

@implementation LSMultipleAchievements (RCTNativeModel)

- (NSDictionary *)reactNativeRepresentation {
    NSMutableArray *achievements;
    for (LSAchievement *achievement in self.achievements) {
        if (!achievements)
            achievements = [NSMutableArray array];

        [achievements addObject:[achievement reactNativeRepresentation]];
    }

    return @{@"achievements": RCTNullIfNil(achievements),
             @"totalPoints": RCTNullIfNil(self.totalPoints)
             };
}

@end
