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

#import "HereSDKDemandRideOffer+Dictionary.h"
#import "HereSDKDemandPublicTransportRideOffer+Dictionary.h"
#import "HereSDKDemandPublicTransportRouteLeg+Dictionary.h"

@implementation HereSDKDemandPublicTransportRideOffer (Dictionary)

- (NSDictionary *)dictionary
{
  NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:super.dictionary];

  NSMutableArray *legsArr = [NSMutableArray new];
  for (HereSDKDemandPublicTransportRouteLeg* leg in self.sectionsArray)
  {
    [legsArr addObject:leg.dictionary];
  }

  [dict addEntriesFromDictionary:@{
                                   @"transfers": [NSNumber numberWithInt:self.transfers],
                                   @"legs": legsArr,
                                   @"type": @"PUBLIC_TRANSPORT",
                                   }];
  return dict;
}

@end
