/***************************************************************
 * Copyright © 2018 HERE Global B.V. All rights reserved. *
 **************************************************************/

#import "RCTConvert+HereSDKDemandPassenger.h"
#import <HereSDKDemandKit/HereSDKDemandPassenger.h>
#import "NSString+Utilities.h"

static const NSString *kHereSDKDemandPassengerName = @"name";
static const NSString *kHereSDKDemandPassengerPhoneNumber = @"phoneNumber";
static const NSString *kHereSDKDemandPassengerPhotoUrl = @"photoUrl";
static const NSString *kHereSDKDemandPassengerEmail = @"email";

@implementation RCTConvert (HereSDKDemandPassenger)

+ (HereSDKDemandPassenger *)HereSDKDemandPassenger:(id)json
{
    json = [self NSDictionary:json];
    return [HereSDKDemandPassenger
            passengerWithName:json[kHereSDKDemandPassengerName]
            phoneNumber:json[kHereSDKDemandPassengerPhoneNumber]
            photoUrl:json[kHereSDKDemandPassengerPhotoUrl]
            email:json[kHereSDKDemandPassengerEmail]];
}

+ (NSDictionary *)DictionaryHereSDKDemandPassenger:(HereSDKDemandPassenger *)object
{
    return @{
             kHereSDKDemandPassengerName: [NSString hereSDK_utilities_emptyOrString:object.name],
             kHereSDKDemandPassengerPhoneNumber: [NSString hereSDK_utilities_emptyOrString:object.phoneNumber],
             kHereSDKDemandPassengerPhotoUrl: [NSString hereSDK_utilities_emptyOrString:object.photoURL],
             kHereSDKDemandPassengerEmail: [NSString hereSDK_utilities_emptyOrString:object.email],
             };
}

@end
