//
//  MVMCoreActionDelegateProtocol.h
//  myverizon
//
//  Created by Scott Pfeil on 11/20/15.
//  Copyright © 2015 Verizon Wireless. All rights reserved.
//

#import <Foundation/Foundation.h>

@class MVMCoreErrorObject;
@class MVMCoreRequestParameters;
@class MVMCoreAlertObject;

@protocol MVMCoreActionDelegateProtocol

@optional

// Gives the delegate an opportunity to do it's own logging. If not it will do it's own logging.
- (void)logActionWithActionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData;

// Handles the open page actions. Can overwrite for special loading.
- (void)handleOpenPageForRequestParameters:(nonnull MVMCoreRequestParameters *)requestParameters actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData;

// Handles the back actions. Can overwrite for special loading.
- (void)handleBackAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData;

// Prepares to call the previous submit request again. Can overwrite for special loading. Be sure to call submit() block to perform the actual load.
- (void)prepareRequestForPreviousSubmission:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData submit:(nonnull void (^)(MVMCoreRequestParameters * _Nonnull requestParameters, NSDictionary * _Nullable dataForPage))submit;

// Handles the linkaway action. Call the block to continue to linkaway.
- (void)shouldLinkAwayWithURL:(nullable NSURL *)URL appURL:(nullable NSURL *)appURL actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData linkAwayBlock:(nonnull void (^)(NSURL * _Nullable appURL, NSURL * _Nullable URL, NSDictionary  * _Nullable actionInformation, NSDictionary  * _Nullable additionalData))linkAwayBlock;

// Gives the delegate a chance to alter the alert object
- (void)willShowPopupWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject alertJson:(nonnull NSDictionary *)alertJson;

// Gives the delegate a chance to alter the alert object
- (nullable MVMCoreAlertObject *)willShowTopAlertWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject alertJson:(nonnull NSDictionary *)alertJson;

// Handle cancel
- (void)handleCancel:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData;

// Handles any unknown action types. Can overwrite for more specific handling.
- (void)handleUnknownActionType:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData;

// Handles any action errors. Can overwrite for more specific handling.
- (void)handleActionError:(nonnull MVMCoreErrorObject *)error additionalData:(nullable NSDictionary *)additionalData;

// Lets the delegate know that another internal module app is about to be launched
- (void)prepareForOpenOtherAppModule:(nullable NSString *)module;

@end
