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

#import "HereSDKDemandCancellationInfo+Dictionary.h"
#import "NSString+Utilities.h"
#import "NSDate+NSNumber.h"

@implementation HereSDKDemandCancellationInfo (Dictionary)

+ (NSString *)cancellationPolicyToString:(HereSDKDemandCancellationPolicy)cancellationPolicy
{
    switch(cancellationPolicy)
    {
        case HereSDKDemandTripCancellationPolicyAllowed:
            return @"ALLOWED";
        case HereSDKDemandTripCancellationPolicyNotAllowed:
            return @"NOT_ALLOWED";
    }
}

+ (NSString *)cancellationPartyToString:(HereSDKDemandCancellationInfoParty)cancellationParty
{
    switch(cancellationParty)
    {
        case HereSDKDemandCancellationInfoPartyUnknown:
            return @"UNKNOWN";
        case HereSDKDemandCancellationInfoPartyDemander:
            return @"DEMANDER";
        case HereSDKDemandCancellationInfoPartySupplier:
            return @"SUPPLIER";
    }
}

+ (NSString *)cancellationStatusToString:(HereSDKDemandCancellationStatus)cancellationStatus
{
    switch(cancellationStatus)
    {
        case HereSDKDemandCancellationStatusUnknown:
            return @"UNKNOWN";
        case HereSDKDemandCancellationStatusProcessing:
            return @"PROCESSING";
        case HereSDKDemandCancellationStatusAccepted:
            return @"ACCEPTED";
        case HereSDKDemandCancellationStatusRejected:
            return @"REJECTED";
    }
}

- (NSDictionary *)dictionary
{
    return @{
             @"cancellingParty": [HereSDKDemandCancellationInfo cancellationPartyToString:self.cancellingParty],
             @"cancelReason": self.cancelReason,
             @"requestTime": self.requestTime.hereSdk_toNumber,
             @"status": [HereSDKDemandCancellationInfo cancellationStatusToString:self.cancellationStatus],
             };
}

@end
