//
//  NonconformityDataController.h
//  EAMNext
//
//  Created by Surojit Bhattacharya on 9/13/16.
//
//

#import <Foundation/Foundation.h>
#import "R5NONCONFORMITIESHEADER.h"
#import "R5NONCONFORMITIES.h"
#import "RecordDataController.h"
#import "EAMAppDelegate.h"
#import "R5OBSERVATIONS.h"

@class WebQueryParameters;
@class EAMAppDelegate;
@class DBQuery;
@class GridData;

typedef enum {
    Nonconformity,
    Observation,
    GIS
}NonconformityType;

@interface NonconformityDataController : RecordDataController
{
    R5NONCONFORMITIES *_recordValue;
}

@property (nonatomic) BOOL isAddMode;
@property (nonatomic) BOOL isGISNonconformity;
@property (nonatomic) BOOL isFromEquipment;

@property (nonatomic) NSString * currentworkorder;
@property (nonatomic) NSString * fromStatus;
@property (nonatomic, strong) NSObject *ncfLookupDataObj;
@property (nonatomic, strong) NSDictionary     *UDFields;
@property (nonatomic, strong)   NSDictionary                *customFields;
@property (nonatomic, strong)   R5OBSERVATIONS              *observation;
@property (nonatomic, assign)               BOOL                    isCustomFieldValueChanged;
@property (nonatomic, assign)               BOOL isRepair;
- (BOOL)validateInput;
- (void)addNonconformity;
- (void)updateNonconformity;
-(void) getNonconformityObservationForGIS;
- (void)deleteNonconformity;
- (void)getNonconformities;
- (void)getWONonconformities:(NSString *)wonum withOrg:(NSString *)woorg;
- (void)getNonconformity;
-(void)getNonconformityObservation;
-(void) getEquipmentInspectionNonconformityObservation;
- (void) getDefaultNonconformity;
-(void)getDefaultNonconformityObservation;
- (void)closeAllNonconformity : (NSString *)workorder;
- (void)repairedAllNonconformity: (NSString *)workorder;
- (void)resetAllNonconformity : (NSString *)workorder;
- (LOVData *)getLOVDataSource:(NSString *)lovName;
- (PickerData *)getPickerDataSource:(NSString *)fieldName;
- (void)enableFields:(BOOL)setReadOnly;
- (void)enableFieldsLASec:(BOOL)setReadOnly;
- (R5NONCONFORMITIES *)convertModelForEditMode:(R5NONCONFORMITIES *)nonconformity;
- (void) updatePickerValues;
-(BOOL) isEquipmentHaveDeptSecurity:(NSString *)evtcode;
- (void)addOrRemoveLinearAssetFields;
-(NSDecimalNumber *)calculateTotalEstimatedCosts:(R5NONCONFORMITIES *)nonConformity;
-(R5NONCONFORMITIES *)setVMRSCodeXMLPathForDisplay:(R5NONCONFORMITIES *)mRecordValue;
-(void)getEquipmentNonconformities:(NSString *)equipment withOrg:(NSString *)equipOrg;
-(void)getObservations:(R5OBSERVATIONS *)pObservation;
//-(void)getObservationsForEquipmentNonconformity:(NSString *)nonconformity andOrg:(NSString *)org;
-(void)updateStatus:(R5NONCONFORMITIES *)currentRecord withNewStatus:(NSString *)newStatus forEntity:(NSString *)recordType;
-(NSString *)getKeyForValue:(NSString *)value;
-(void)addObservation;
-(void)getObservation;
-(void)updateObservation;
-(void)addCustomFields;
//-(void)loadRecordViewLayoutForNonconformity;
-(void)updatePickerValuesForNonconformityHeader;
-(id)initLoadRecordView:(NonconformityType)pConformityType forUDFEntityType:(UDFEntityType *)pUDFEntityType;
-(void)getEquipmentNonconformities:(NSString *)equipment withOrg:(NSString *)equipOrg withSearch:(NSString *)search;
- (void)getWONonconformities:(NSString *)wonum withOrg:(NSString *)woorg withSearch:(NSString *)search;
- (void)massAcknowledge: (NSString *)workorder;
-(BOOL)isAllowMassNonconformity;
-(void)addObservations;
-(void)deleteObservation;
-(void)getImportNonconformities:(NSString *)equipment withOrg:(NSString *)equipOrg withWO:(NSString *)workOrder;
-(void)importObservation:(R5OBSERVATIONS *)observation;
-(void)getDefaultNonconformityObservation:(NSString *)pCode andOrg:(NSString *)pOrg;
@end
