//
//  JMapDirection.h
//  JMapNavigationKit
//
//  Created by Louie Yuen on 2017-05-05.
//  Copyright © 2017 Jibestream. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "JMapCoreKit.h"

/**
 * The Direction Class
 */
@interface JMapDirection : NSObject

/**
 * The direction value, i.e. Left/Right etc.
 */
@property (nonatomic, strong, nullable) NSString * value;
/**
 * First point in direction generation
 */
@property (nonatomic, strong, nonnull) JMapWaypoint * a;
/**
 * Second point in direction generation
 */
@property (nonatomic, strong, nonnull) JMapWaypoint * b;
/**
 * Third point in direction generation
 */
@property (nonatomic, strong, nullable) JMapWaypoint * c;

/**
 * The threshold for determining left/right/forward direction values
 */
@property (nonatomic, nullable) NSNumber *threshold;

/**
 * The threshold for determining u-turn direction values
 */
@property (nonatomic, nullable) NSNumber *uTurnThreshold;

/**
 * Angle generated using a,b,c points
 */
@property (nonatomic, assign) float angle;

/**
 * Constant right variable
 */
extern NSString * _Nonnull const RIGHT;
/**
 * Constant left variable
 */
extern NSString * _Nonnull const LEFT;
/**
 * Constant forward variable
 */
extern NSString * _Nonnull const FORWARD;
/**
 * Constant u-turn variable
 */
extern NSString * _Nonnull const UTURN;
/**
 * Constant arrive variable
 */
extern NSString * _Nonnull const ARRIVE;

/**
 * Initialization method for creating a direction instance
 *
 * @param a The first point in direction generation
 * @param b The second point in direction generation
 * @param c The third point in direction generation
 * @param threshold The angle threshold for determining left,right and forward instructions
 * @param uTurnThreshold The angle threshold for determining a u-turn instruction
 * @return A direction instance generated by using the three points
 */
- (nonnull instancetype)initWithA:(nonnull JMapWaypoint *)a b:(nullable JMapWaypoint *)b c:(nullable JMapWaypoint *)c threshold:(nullable NSNumber *)threshold uTurnThreshold:(nullable NSNumber *)uTurnThreshold;

/**
 * Get method for direction value
 */
- (nullable NSString *)getValue;

/**
 * Class method for calculating the angle between two waypoints
 */
+ (float)getAngleFrom:(nonnull JMapWaypoint *)from to:(nonnull JMapWaypoint *)to;

@end
