//
//  LSSurveyActivity+RCTNativeModel.m
//  ReactLightspeedSDK
//
//  Created by marc matta on 12/18/17.
//  Copyright © 2017 com.lightspeed. All rights reserved.
//

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

NSString * LSSurveyStatusConvert(id value) {
    return [@{@(SurveyStatusNone) : @"SurveyStatusNone",
              @(SurveyStatusCompleted) : @"SurveyStatusCompleted",
              @(SurveyStatusScreened) : @"SurveyStatusScreened",
              @(SurveyStatusQuotaFull) : @"SurveyStatusQuotaFull",
              @(SurveyStatusStudyClosed) : @"SurveyStatusStudyClosed",
              @(SurveyStatusAlreadyTaken) : @"SurveyStatusAlreadyTaken",
              @(SurveyStatusStudyTemporarilyClosed) : @"SurveyStatusStudyTemporarilyClosed"} objectForKey:value];
}

@implementation LSSurveyActivity (RCTNativeModel)
- (NSDictionary *)reactNativeRepresentation {
    return @{@"awardAmount": @(RCTZeroIfNaN(self.awardAmount)),
             @"awardType": @(self.awardType),
             @"surveyId": @(RCTZeroIfNaN(self.surveyId)),
             @"date": RCTNilIfNull(self.dateString),
             @"status": LSSurveyStatusConvert(@(self.status))
             };
}
@end
