//
//  MVMCoreLoadObject.h
//  myverizon
//
//  Created by Scott Pfeil on 11/16/15.
//  Copyright © 2015 Verizon Wireless. All rights reserved.
//
//  An object that holds load data

#import <Foundation/Foundation.h>
#import <MVMCore/MVMCoreLoadDelegateProtocol.h>
#import <MVMCore/MVMCorePresentationDelegateProtocol.h>
#import <MVMCore/MVMCoreActionDelegateProtocol.h>

@class MVMCoreLoadRequestOperation;
@class MVMCoreRequestParameters;
@class DelegateObject;

@interface MVMCoreLoadObject : NSObject

// The page that was loaded.
@property (nullable, strong, nonatomic) NSString *pageType;

// The data for hte page that was loaded
@property (nullable, strong, nonatomic) NSDictionary *pageJSON;

// Contains the button map
@property (nullable, nonatomic, strong, readonly) NSDictionary *buttonMap;

// the modules that are needed
@property (nullable, strong, nonatomic) NSDictionary *modulesJSON;

// the response info
@property (nullable, strong, nonatomic) NSDictionary *responseInfoMap;

// any additional parameters
@property (nullable, strong, nonatomic) NSDictionary *systemParametersJSON;

// The request
@property (nullable, strong, nonatomic) MVMCoreRequestParameters *requestParameters;

// any additional data for the page
@property (nullable, strong, nonatomic) NSDictionary *dataForPage;

// The load delegate
@property (nullable, weak, nonatomic) NSObject <MVMCoreLoadDelegateProtocol,MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol> *delegate __deprecated;
@property (nullable, strong, nonatomic) DelegateObject *delegateObject;

// The operation that is loading.
@property (nullable, weak, nonatomic) MVMCoreLoadRequestOperation *operation;

// Flags for if we loaded from the cache.
@property (nonatomic) BOOL pageDataFromCache;
@property (nonatomic) BOOL moduleDataFromCache;

- (nullable instancetype)initWithPageJSON:(nullable NSDictionary *)pageJSON modulesJSON:(nullable NSDictionary *)modulesJSON requestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegateObject:(nullable DelegateObject *)delegateObject;

- (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegateObject:(nullable DelegateObject *)delegateObject;

- (nullable instancetype)initWithDelegateObject:(nullable DelegateObject *)delegateObject;

- (nullable instancetype)initWithPageJSON:(nullable NSDictionary *)pageJSON errorObject:(nullable MVMCoreErrorObject *)errorObject;

// Returns whether the load will extend the app session timer based on the response provided by the server.
- (BOOL)extendsAppSession;

#pragma mark - Deprecated

- (nullable instancetype)initWithPageJSON:(nullable NSDictionary *)pageJSON modulesJSON:(nullable NSDictionary *)modulesJSON requestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject<MVMCoreLoadDelegateProtocol,MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate __deprecated;

- (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject<MVMCoreLoadDelegateProtocol,MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate __deprecated;

- (nullable instancetype)initWithDelegate:(nullable NSObject<MVMCoreLoadDelegateProtocol,MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate __deprecated;

@end
