//
//  RecordViewController.h
//  iEAM
//
//  Created by Weikang Ding on 10-3-31.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "EAMField.h"
#import "RecordViewCell.h"
#import "LOVViewController.h"
#import "DateTimeViewController.h"
#import "PickerViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "ScreenDesignerViewController.h"
#import "R5ADDETAILS.h"
#import "R5DOCUMENTS.h"

@protocol RecordViewDelegate <NSObject>
@optional

- (LOVData *)fetchLOVDefinition:(NSString *)lovName;
- (PickerData *)fetchPickerDefinition:(NSString *)fieldName;
- (void)updateFieldValue:(NSString *)fieldName withValues:(NSArray *)data;
- (void)childListViewRowSelected:(NSString *)listViewKey index:(NSInteger )index;
- (void)childListViewRowDeleted:(NSString *)listViewKey index:(NSInteger )index;
- (void)headerButtonClicked:(NSString *)buttonKey sectionKey:(NSString *)sectionKey;
- (void)refreshRecordViewLayout;
- (void)updateComment:(R5ADDETAILS *)comment addMode:(BOOL )addMode;
- (void)deleteComment:(R5ADDETAILS *)comment;
- (void)updateDocument:(R5DOCUMENTS *)document;
- (void)deleteDocument:(R5DOCUMENTS *)document;
- (void)buttonHandler:(NSString *)handlerName;
- (void)scanAsset:(id)sender;

@end


@interface RecordViewController : UITableViewController < UITextFieldDelegate, UITextViewDelegate, DateTimeViewControllerDelegate, LOVViewControllerDelegate, PickerViewControllerDelegate> {

	BOOL keyboardShown;
}
@property (nonatomic, strong)ScreenDesignerViewController *screenDesignerVC;
@property (nonatomic, strong) NSMutableDictionary *fieldDefinition; 
@property (nonatomic, strong) NSArray *fieldLayout;
@property (nonatomic, strong) NSMutableDictionary *fieldValues;
@property (nonatomic, strong) NSMutableDictionary *fieldListViewValues;
@property (nonatomic, strong) NSMutableArray *recordViewComments;
@property (nonatomic, strong) NSMutableArray *recordViewDocuments;

@property (nonatomic, strong) UITextField   *textFieldBeingEdited;
@property (nonatomic, strong) UITextView    *textViewBeingEdited;
@property (nonatomic, strong) NSString      *textFieldNameBeingEdited;

@property (unsafe_unretained) id<RecordViewDelegate> delegate;
@property (nonatomic, strong) UIPopoverController   *popoverController;
//-- Screen Config Change Start
@property (nonatomic, strong) NSString              *screenName;
@property (nonatomic, strong) NSString              *groupName;
@property (nonatomic, strong) NSString              *systemScreenName;
@property (nonatomic        ) BOOL                  showDesignerButton;
@property (nonatomic       ) BOOL                  showScanAssetButton;
@property (nonatomic       ) BOOL                  isAttachment;
//-- Screen Config Change End
@property (nonatomic        ) BOOL                  commentEnabled;  //Control if the comment section is editable
@property (nonatomic        ) BOOL                  documentEnabled;  //Control if the documment section is editable
@property (nonatomic        ) BOOL                  locationEnabled;  //Control if the location button is editable

- (void)commitData;
- (void)showRecordView:(BOOL)show;
- (void)setBackgroundImage:(UIImage *)bgImage;
- (void)setLayerProperties;
- (void)openScreenDesigner;


@end
