//
//  PermissionController.h
//  EAMiPadConnected
//
//  Created by Weikang Ding on 3/5/15.
//
//

#import <Foundation/Foundation.h>
#import "FunctionPermissions.h"
//MAIN MENU FUNCTION NAMES
#define  FunctionType_GIS               @"BCBGIS"
#define  FunctionType_DUX               @"DUX"
#define  FunctionType_WORKORDER         @"WCJOBS"
#define  FunctionType_EQUIPMENT         @"OCOBJA"
#define  FunctionType_WORKREQUEST       @"WCWREQ"
#define  FunctionType_ASSETINVENTORY    @"OCINVP"
#define  FunctionType_WORKHOURS         @"WCHOUR"
#define  FunctionType_BREADCRUMBS       @"BCLBSS"
#define  FunctionType_FACETIME          @"BCFACE"
#define  FunctionType_OPERATORCHECKLIST @"BCOPCL"
#define  FunctionType_PORECEIPT         @"SCRECV"
#define  FunctionType_RECEIVEASSET      @"SCRECA"
#define  FunctionType_MAPVIEW           @"BCBMAP"
#define  FunctionType_JSIWORKORDER      @"WCWJSI"
#define  FunctionType_MOBILENOTEBOOK    @"OCMNBK"
#define  FunctionType_PHYSICALINVENTORYCONNECTED @"SCPHYS"
#define  FunctionType_PHYSICALINVENTORY @"SCPINV"
#define  FunctionType_PERMITTOWORK      @"WCPMTW"
#define  FunctionType_BATCHBOOKLABOR   @"WCBOOE"
#define  FunctionType_FLEX              @"BCFLEX"

//Tab Items function Names
#define  FunctionType_WOACTIVITY    @"WCACTJ"
#define  FunctionType_CLOSEWO       @"WCCOMP"
#define  FunctionType_WOCOMMENT     @"WCCOMM"
#define  FunctionType_WODOCUMENTS   @"WCDOCW"
#define  FunctionType_WOEQUIPMENT   @"WCWOEQ"
#define  FunctionType_INSPECTION    @"ICRSLT"
#define  FunctionType_WONONCONFORMITY   @"WCNOCF"
#define  FunctionType_WORKORDERSAFETY      @"WCWOSF"
#define  FunctionType_WORKORDERSURVEYEQUIPMENT   @"WCSURV"

#define  FunctionType_PROOFOFDELEVERY   @"WCPROF"

#define  FunctionType_CHECKLIST     @"WCJACK"
#define  FunctionType_BOOKLABOR     @"WCBKEV"
#define  FunctionType_PLANNEDPART   @"WCMATL"
#define  FunctionType_ISSUERETURN   @"SCISSU"
#define  FunctionType_ADDITIONALCOSTS   @"WCMISC"
#define  FunctionType_SCHEDULELABOR     @"WCJSCH"
#define  FunctionType_TOOLPLAN          @"WCJTPL"
#define  FunctionType_TOOLUSAGE         @"WCJTOU"

#define  FunctionType_EQUIPDOCUMENTS    @"OCDOCW"
#define  FunctionType_EQUIPCOMMENT  @"OCCOMM"
#define  FunctionType_EQUIPSTRUCTURE    @"OCSTRU"
#define  FunctionType_EQUIPHISTORY      @"OCHIST"
#define  FunctionType_METERREADING      @"OCREAD"
#define  FunctionType_METERS            @"OCMETR"
#define  FunctionType_OPENWOFROMEQUIP   @"OCORWO"
#define  FunctionType_LINEAROVERVIEW    @"OCOLNO"

#define  FunctionType_PERMITTOWORKLOTO   @"WCLOTO"
#define  FunctionType_PERMITTOWORKSAFETY      @"WCPKSF"


#define  FunctionType_NONCONFORMITY     @"BCNOCF"
#define  FunctionType_EQUIPNONCONFORMITY   @"OCNOCF"
#define  FunctionType_RECORDDAMAGE      @"OCWKMV"

//Function Names added for 11.6
#define  FunctionType_TAB_EQUIPCOMMENT  @"CMT"
#define  FunctionType_TAB_EQUIPDOCUMENTS @"DOC"
#define  FunctionType_TAB_EQUIPHISTORY @"HST"
#define  FunctionType_TAB_LINEAROVERVIEW @"LNO"
#define  FunctionType_TAB_EQUIPNONCONFOMITY @"MEN"
#define  FunctionType_TAB_EQUIPMENTMETER @"MET"
#define  FunctionType_TAB_MAPVIEW @"MMP"
#define  FunctionType_TAB_PERMITTORECORDDAMAGE @"MRD"
#define  FunctionType_TAB_OPENWOFROMEQUIP @"RWO"
#define  FunctionType_TAB_EQUIPSTRUCTURE @"STC"
#define  FunctionType_TAB_WOCOMMENT @"CMT"
#define  FunctionType_TAB_WODOCUMENTS @"DOC"
#define  FunctionType_TAB_WORKORDERSURVEYEQUIPMENT @"CGO"
#define  FunctionType_TAB_ADDITIONALCOSTS @"ACO"
#define  FunctionType_TAB_WOACTIVITY @"ACT"
#define  FunctionType_TAB_CHECKLIST @"CHK"
#define  FunctionType_TAB_CLOSEWO @"CWO"
#define  FunctionType_TAB_WORKORDERSAFETY @"ESF"
#define  FunctionType_TAB_INSPECTION @"INS"
#define  FunctionType_TAB_BOOKLABOR @"MBK"
#define  FunctionType_TAB_WOEQUIPMENT @"MEP"
#define  FunctionType_TAB_ISSUERETURN @"MIR"
#define  FunctionType_TAB_PROOFOFDELEVERY @"MPD"
#define  FunctionType_TAB_PLANNEDPART @"MPP"
#define  FunctionType_TAB_WONONCONFORMITY @"NCF"
#define  FunctionType_TAB_SCHEDULELABOR @"SCH"
#define  FunctionType_TAB_TOOLUSAGE @"TOU"
#define  FunctionType_TAB_PLANTOOL @"TTO"
#define  FunctionType_TAB_WORKORDERACCOMPLISHMENTS @"EAC"

#define  FunctionType_TAB_PERMITTOWORKLOTO @"LTO"
#define  FunctionType_TAB_PERMITTOWORKSAFETY @"MSF"
#define  FunctionType_TAB_PERMITTOWORKCONTRACTERSIGN @"CTS"
#define  FunctionType_TAB_PERMITTOWORKCOMMENTS @"CMT"
#define  FunctionType_TAB_PERMITTOWORKDOCUMENTS  @"DOC"

#define  FunctionType_TAB_NOTEBOOKREFERENCE @"REF"
#define  FunctionType_TAB_NOTEBOOKEMAIL @"EML"
#define  FunctionType_TAB_NOTEBOOKCOMMENTS @"CMT"
#define  FunctionType_TAB_NOTEBOOKDOCUMENTS @"DOC"

#define  FunctionType_TAB_OBSERVATIONDETAILS @"NCO"
#define  FunctionType_TAB_NONCONFORMITYCOMMENTS @"NCM"
#define  FunctionType_TAB_NONCONFORMITYDOCUMENTS @"NDC"
#define  FunctionType_TAB_OBSERVATIONLIST @"NOS"
#define  FunctionType_TAB_OBSERVATIONCOMMENTS @"NOC"
#define  FunctionType_TAB_OBSERVATIONDOCUMENTS @"NOD"

#define  FunctionType_TAB_ACTIVITYPMCOMMENTS @"PMC"
#define  FunctionType_TAB_ACTIVITYCOMMENTS @"ACM"
#define  FunctionType_TAB_ACTIVITYTASKINSTRUCTIONS @"TIS"

#define  FunctionType_TAB_PERMITTOWORKLOTOCOMMENTS @"LCM"
#define  FunctionType_TAB_PERMITTOWORKLOTOISOLATIONMETHODCOMMENTS @"IMC"
#define  FunctionType_TAB_PERMITTOWORKLOTOISOLATIONPOINTCOMMENTS @"IPC"
#define  FunctionType_TAB_PERMITTOWORKLOTODOCUMENTS @"LDC"
#define  FunctionType_TAB_PERMITTOWORKLOTOISOLATIONMETHODDOCUMENTS @"IMD"
#define  FunctionType_TAB_PERMITTOWORKLOTOISOLATIONPOINTDOCUMENTS @"IPD"

@interface PermissionController : NSObject{
    
}

+(void)reset;
+(FunctionPermissions *)getPermissions:(NSString *)functionType;

-(BOOL)canSelect:(NSString *)functionID error:(NSString *__autoreleasing *)errorMessage;
-(BOOL)canInsert:(NSString *)functionID error:(NSString *__autoreleasing *)errorMessage;
-(BOOL)canUpdate:(NSString *)functionID error:(NSString *__autoreleasing *)errorMessage;
-(BOOL)canDelete:(NSString *)functionID error:(NSString *__autoreleasing *)errorMessage;

- (BOOL)canTabSelect:(NSString *)tabType andFunctionName:(NSString *)functionName error:(NSString **)errorMessage;
- (BOOL)canTabInsert:(NSString *)tabType andFunctionName:(NSString *)functionName error:(NSString **)errorMessage;
- (BOOL)canTabUpdate:(NSString *)tabType andFunctionName:(NSString *)functionName error:(NSString **)errorMessage;
- (BOOL)canTabDelete:(NSString *)tabType andFunctionName:(NSString *)functionName error:(NSString **)errorMessage;
+(NSMutableArray *)getMenuList;
+(NSMutableArray *)getTabList:(NSString *)functionName;
@end
