//
//  JSFacade.h
//  kneet2
//
//  Created by Created by Jason Lee on 10/1/15.
//  Copyright (c) 2015 ntels. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "Common.h"
#import "Definitions.h"
#import "CommonUtil.h"


//Categories
#import "NSString-Addtions.h"
#import "NSDate+Utilities.h"
#import "UITableView+EnumarateCells.h"
#import "TargetConditionals.h"

//OpenSource
//#import "ReactiveCocoa.h"

#import "AppDelegate.h"

#import "LoginModel.h"
#import "ModeModel.h"

typedef void(^completionCallBackHandler)(void);
typedef void(^failureCallBackHandler)(void);


@interface JDFacade : NSObject

@property (strong, nonatomic) NSString *deviceUUID;   //local uuid
@property (strong, nonatomic) NSString *APNSToken;          //APNS 토큰


@property (strong, nonatomic) LoginModel *loginUser;
@property (strong, nonatomic) HomeGroupModel *loginHomeGroup;

@property (strong, nonatomic) NSArray<ModeModel> *modeList;
@property (assign, nonatomic) KNMenuId wishMenuId;

@property (assign, nonatomic) BOOL hasLoggedIn;

//Local Temporary Variables
@property (strong, nonatomic) NSString *tmpHomegrpName;
@property (strong, nonatomic) NSString *tmpEmailId;
@property (strong, nonatomic) NSString *tmpPassword;



//Local Temporary Variables

+ (JDFacade *)facade;
- (AppDelegate *)appDelegate;

//Screens
- (UIViewController *)currentViewController;
- (id)viewControllerOnNaviationController:(Class)viewControllerClass;
- (id)viewControllerOnPresentingViewController:(UIViewController *)vc viewControllerClass:(Class)viewControllerClass;

//UserDefautls - Local Store
- (void)storeObjectToUserDefaults:(id)object forKey:(NSString *)aKey;
- (id)objectForKeyFromUserDefaults:(NSString *)aKey;

//alert & loading
- (void)loadIndicator:(BOOL)showIndicator allowUserInteraction:(BOOL)allowUserInteracton;
- (void)alert:(NSString *)message;
- (void)warn:(NSString *)message;
- (void)alert:(NSString *)message completionHander:(completionCallBackHandler)handler;
- (void)retryAlert:(NSString *)message target:(id)target selector:(SEL)selector;

- (void)fireLocalNotification:(NSString *)message;
- (void)toast:(NSString *)message;

//Control UI
- (id)getRadioButtonStatus:(id)object;
- (void)setRadioButtonStatus:(id)status object:(id)object;

- (id)getCheckBoxStatus:(id)object;
- (void)setCheckBoxStatus:(id)status object:(id)object;

- (void)presentViewControllerByPush:(UIViewController *)vc;
- (void)presentViewControllerByPush:(UIViewController *)vc pvc:(UIViewController *)pvc;
- (void)dismissViewControllerByPush:(UIViewController *)vc;
- (void)dismissViewControllerByPush:(UIViewController *)vc completion:(completionCallBackHandler)completion;

//UI Flow
- (void)gotoLoginView;
- (void)gotoLoginViewWithExpiring;
- (void)logout;
- (void)loadInvitationView;

- (void)checkDefaultHome;
- (void)gotoStartHome:(BOOL)canGoBack;
//- (void)gotoTutorial:(BOOL)isCalledFromMenu;

- (void)gotoWishMenu:(KNMenuId)menuId;
- (void)gotoWishMenu:(KNMenuId)menuId completion:(completionCallBackHandler)completion;
- (void)updateHomegrpListForLoginUser:(completionCallBackHandler)completion;
- (void)updateLoginInfo:(completionCallBackHandler)completion;


- (void)alertLocationServiceDisabled;
- (void)alertCameraPermissionDisabled;

//Debug
- (BOOL)redirectNSLog;
- (void)showFlex;

@end
