//
//  ScreenDesigner.h
//  EAMiPad
//
//  Created by Satish Kumar Jakkula on 8/7/12.
//
//

#import <Foundation/Foundation.h>
#import "EAMListDesigner.h"
#import "UserDefinedFields.h"

@protocol ScreenDesignerDelegate <NSObject>
@optional

- (void)screenConfigParsingCompleted;

@end


@interface ScreenDesigner : NSObject
{
    
}

@property (unsafe_unretained) id<ScreenDesignerDelegate>    delegate;
@property (nonatomic        ) BOOL                          upgradeCompleted;
@property (nonatomic        ) BOOL                          listViewConfig;


- (void)getScreenConfig:(NSString *)screenName;
- (void)getScreenConfig:(NSString *)screenName forGroup:(NSString *)groupName;
- (NSMutableDictionary *)recordViewFields;
- (NSArray *)recordViewLayout;
- (NSMutableDictionary *)listViewLayout;
- (EAMListDesigner *)listViewLayout2;
- (void)getListDisignerData:(NSString *)group;

- (NSArray *)recordViewLayoutForDesigner;
- (NSMutableDictionary *)recordViewFieldsForDesigner;
- (NSMutableDictionary *)systemFieldDefinition:(NSString *)systemScreenName;

- (BOOL)saveJSONConfiguration:(NSArray *)fieldLayout fieldDefinition:(NSDictionary *)fieldDefinition forScreenName:(NSString *)screenName toGroups:(NSArray *)groups;
- (BOOL)saveJSONConfiguration:(NSString *)jsonString forScreenName:(NSString *)screenName toGroups:(NSArray *)groups;
-(NSString *)buildListViewJSON:(EAMListDesigner *)listDesigner;

- (BOOL)canMakeFieldNotReadOnly:(NSString *)fieldName;
- (BOOL)canMakeFieldNotRequired:(NSString *)fieldName;
- (BOOL)canMakeFieldHidden:(NSString *)fieldName;


- (void)saveScreenConfig:(NSArray *)fieldLayout fieldDefinition:(NSDictionary *)fieldDefinition forScreenName:(NSString *)screenName;

- (void)mergeUDFields:(UDFEntityType )udfEntityType;
-(RecordData *)addDefaultUDFValues:(RecordData *)recordValue forEntityType:(UDFEntityType )udfEntityType;

#pragma mark - Upgrade
- (void)upgradeScreenConfig;
#pragma mark -

@end
