//
//  DataSyncUtility.h
//  EAMiPad
//
//  Created by Ram Madichetty on 1/29/13.
//
//

#import <Foundation/Foundation.h>
#import "GridData.h"
#import "WebQuery.h"

#define WORKORDER_DATASPY_PARAMETER_NAME @"parameter.dataspy"

@interface DataSyncUtility : NSObject

+ (void)dropIndexes;
+ (void)createIndexes;
+ (void)cleanUpTables;
+ (void)parseSynConfigFilters:(NSArray *)filters gridFilters:(NSMutableDictionary **)gridFilters;
+ (NSMutableDictionary *)parseSynConfig:(NSString *)syncConfig;
+ (NSString *)newUpdatedDate;
+ (void)clearData;
+ (NSMutableDictionary *) getPrimaryKeysforTables;
+ (NSString *)getEmployeeForUser:(NSString *)user;
+ (NSString *)getSyncConfig;
+ (NSDictionary *)loadSyncConfigJSONFromString:(NSString *)value;
+ (void)logDBError:(NSError *)error forSQL:(NSString *)sql;
+ (void)buildSqlForTable:(NSString *)table
                gridData:(GridData *)gridData
    primaryKeyCollection:(NSDictionary *)primaryKeyCollection
                  select:(NSString **)select
                  insert:(NSString **)insert
                  update:(NSString **)update
                  delete:(NSString **)delete
            notUsedField:(NSString **)notUsedField
          matchingFields:(NSMutableArray **)matchingFields;
+ (void)getLoginOrgTimeZone;
+ (void)updateGlobalVariables;
+ (BOOL)isKeyColumn:(NSString *)column forTable:(NSString *)table primaryKeyCollection:(NSDictionary *)primaryKeyCollection;
+ (WebQueryParameters *)getParametersFromSyncConfigFilters:(NSDictionary *)syncConfigFilters forGrid:(NSString *)grid;
+ (BOOL)checkIfSyncConfigChangedForGridFilter:(NSString *)gridFilter currentFilters:(NSDictionary *)currentFilters oldFilters:(NSDictionary *)oldFilters;
+ (BOOL)checkIfSyncConfigEnabled:(NSDictionary *)syncConfigFilters forGrid:(NSString *)grid;
+ (void)clearDataForGrid:(NSString *)grid forTable:(NSString *)table withCondition:(NSString *)clearCondition;
+ (void)runSyncDeleteGridData;
+ (WebQueryParameters *)getSyncConfigParametersforGrid:(NSString *)grid;

+ (NSString *)getWorkOrderDatspyId;
+ (NSString *)getEquipmentDatspyId;
+ (NSString *)getPermitToWorkDatspyId;
+ (NSString *)getDefaultWODataspyId;
+ (NSString *)getDefaultEquipDataspyId;
+ (NSString *)getDefaultPermitToWorkDataspyId;
+ (NSString *)getDefaultDataspy:(NSString *)gridName;
+ (BOOL)isPrepareMobileDownloadingWSExists;
+ (NSString *)getDataspyName:(NSString *) pDataspyId;
+ (NSString *)getDataspyFilter:(NSString *)dataspyID;
+ (BOOL)dataspyFilterChanged:(NSString *)gridName;
+ (void)saveDataspyFilter:(NSString *)gridName;
+ (void)resetDMLTypeForActivityTransactions;

@end
