//
//  MVMCoreRequestParameters.h
//  myverizon
//
//  Created by Scott Pfeil on 3/4/14.
//  Copyright (c) 2014 Verizon Wireless. All rights reserved.
//
//  An object for the request parameters

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

// The loading style.
// MFLoadStyleDefault: This means it has not been explicitely set by the developer. Standard push.
// MFLoadStylePush: Set explicitely to push.
// MFLoadStyleReplaceCurrent: Replaces the current view controller if possible.
// MFLoadStyleOnTopOfRoot: Loads ontop of the root controller.
// MFLoadStyleBecomeRoot: Load as the root controller.
typedef NS_ENUM(NSInteger, MFLoadStyle) {
    MFLoadStyleDefault = 0,
    MFLoadStylePush,
    MFLoadStyleReplaceCurrent,
    MFLoadStyleOnTopOfRoot,
    MFLoadStyleBecomeRoot,
    MFLoadStylePresent
};

@interface MVMCoreRequestParameters : NSObject <NSCopying>

// request parameters
@property (nullable, strong, nonatomic) NSString *pageType;
@property (nullable, strong, nonatomic) NSArray *modules;
@property (nullable, strong, nonatomic) NSDictionary *parameters;
@property (nullable, strong, nonatomic) NSData *imageData;

// adding parent pageType for freebee
@property (nullable, strong, nonatomic) NSString *parentPageType;

// Context root for server
@property (nullable, strong, nonatomic) NSString *contextRoot;

// A flag for if you do not want to try loading any actual view controller. (Unless there is an error screen)
@property (assign, nonatomic) BOOL noViewControllerToLoad;

// A flag for if you want a view controller to be created but not displayed. (Unless there is an error screen)
@property (assign, nonatomic) BOOL dontDisplayViewController;

// A flag for if you don't want loading overlay to display.
@property (nonatomic) BOOL noloadingOverlay;

// A flag for if we should hide any errors from the user or not.
@property (assign, nonatomic) BOOL handleErrorsSilently;

// A flag for if you want to override pushing view animated or not.
@property (assign, nonatomic) BOOL shouldNotAnimatePush;

// A flag for if we want to override making a request to server if fail to load from cache
@property (assign, nonatomic) BOOL shouldNotGoToServerOnCacheFail;

// A flag for if we never want to load from the cache
@property (assign, nonatomic) BOOL neverLoadFromCache;

// A flag for if we should be adding the initial request parameters.
@property (assign, nonatomic) BOOL addInitialRequestParameters;

// A list of initial parameter sections to blacklist / skip.
@property (nullable, strong, nonatomic) NSSet<NSString *> *excludedInitialParameters;

// A flag for if we should always show alerts, even during a background load.
@property (assign) BOOL allowAlertsIfBackgroundRequest;

// Determines how it is loaded.
@property (nonatomic) MFLoadStyle loadStyle;
@property (nonatomic) BOOL replaceViewIfOnStackElseLoadWithStyle;

// A flag for if a tab was pressed to cause this load. This will ensure that we do not load a new tab page.
@property (nonatomic) BOOL tabWasPressed;

// Can provide a specific navigation controller to use for loading. Will use the default other wise.
@property (nullable, weak, nonatomic) UINavigationController *navigationController;

// If the request was created with an action map.
@property (nullable, strong, nonatomic) NSDictionary *actionMap;

// only used when the base url is not the same as mf 
@property (nullable, strong, nonatomic) NSURL *alternateBaseURL;

@property (nullable, strong, nonatomic) NSNumber *customTimeoutTime;
    
// Will open support panel at the end of the load.
@property (nonatomic) BOOL openSupportPanel;

// A list of page types that this operation should NOT be loaded in parallel with.
@property (nullable, strong, nonatomic) NSArray<NSString *> * successivePageTypes;

// Creates an object with the given page type and extra parameters. Adds the extra parameters to the standard request parameters. Will add any modules needed by the page type by default.
- (nullable instancetype)initWithPageType:(nonnull NSString *)pageType extraParameters:(nullable NSDictionary *)extraParameters;

// Creates an object with the given page type, modules, and extra parameters. Adds the extra parameters to the standard request parameters.
- (nullable instancetype)initWithPageType:(nonnull NSString *)pageType additionalModules:(nonnull NSArray *)additionalModules extraParameters:(nullable NSDictionary *)extraParameters;

// Creates an object with the given modules. Adds the extra parameters to the standard request parameters.
- (nullable instancetype)initWithModules:(nonnull NSArray *)modules extraParameters:(nullable NSDictionary *)extraParameters;

// Initializes the object with an action map.
- (nullable instancetype)initWithActionMap:(nonnull NSDictionary *)actionMap;

// Adds the passed in parameters.
- (void)addRequestParameters:(nonnull NSDictionary *)parameters;

// Removes the passed in parameters.
- (void)removeRequestParameterWithKey:(nonnull NSString *)key;

// Sets the load style based on the server sent presentationStyle
- (void)setMFLoadStyleBasedOnPresentationStyle:(nonnull NSString *)presentationStyle;

@end
