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

#import "HereSDKDemandRide+Dictionary.h"

#import "HereSDKDemandVehicle+Dictionary.h"
#import "HereSDKDemandDriver+Dictionary.h"
#import "HereSDKDemandPriceEstimate+Dictionary.h"
#import "HereSDKDemandRoute+Dictionary.h"
#import "HereSDKDemandBookingConstraints+Dictionary.h"
#import "HereSDKDemandSupplier+Dictionary.h"
#import "RCTConvert+HereSDKDemandPassenger.h"
#import "HereSDKDemandRideStatusLog+Dictionary.h"
#import "HereSDKDemandCancellationInfo+Dictionary.h"
#import "NSString+Utilities.h"
#import "NSDate+NSNumber.h"

@implementation HereSDKDemandRide (Dictionary)

- (NSDictionary *)dictionary
{
    return @{
             @"userId": self.userId,
             @"rideId": self.rideId,
             @"route": self.route.dictionary,
             @"prebookPickupTime": (self.prebookPickupTime) ? self.prebookPickupTime.hereSdk_toNumber : [NSNull null],
             @"bookingEstimatedPrice": (self.bookingEstimatedPrice) ? self.bookingEstimatedPrice.dictionary : [NSNull null],
             @"constraints": (self.constraints) ? self.constraints.dictionary : [NSNull null],
             @"supplier": (self.supplier) ? self.supplier.dictionary : [NSNull null],
             @"statusLog": self.statusLog.dictionary,
             @"passenger": [RCTConvert DictionaryHereSDKDemandPassenger:self.passenger],
             @"passengerNote": [NSString hereSDK_utilities_emptyOrString:self.passengerNote],
             @"driver": (self.driver) ? self.driver.dictionary : [NSNull null],
             @"vehicle": (self.vehicle) ? self.vehicle.dictionary : [NSNull null],
             @"cancellationPolicy": [HereSDKDemandCancellationInfo cancellationPolicyToString:self.cancellationPolicy],
             @"cancellationInfo": (self.cancellationInfo) ? self.cancellationInfo.dictionary : [NSNull null],
             };
}

@end
