//
//  InfoFieldCell.h
//  InforMobile
//
//  Created by Nookaraju Maddila on 7/14/17.
//  Copyright © 2017 Infor Global Solutions. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "AppDefinitions.h"

@class InfoFieldModel;
@class InfoFieldCell;
@protocol InfoEditingDelegate <NSObject>
@required
- (NSIndexPath *)getCurrentEditingIndexPath;
- (void)setCurrentEditingIndexPath:(NSIndexPath *)indexPath;
- (NSIndexPath *)getNextEditingIndexPath;
- (void)setNextEditingIndexPath:(NSIndexPath *)indexPath;
@optional
// General Methods
- (BOOL)shouldBeginEditingField:(InfoFieldModel *)model;
- (void)didBeginEditingField:(InfoFieldModel *)model;
- (BOOL)shouldChangeValueForField:(InfoFieldModel *)model newValue:(id)newValue;
- (void)didChangeValueForField:(InfoFieldModel *)model;
- (void)didEndEditingField:(InfoFieldModel *)model;
- (void)editReturnBtnPressed;
// Action for combo list
- (void)editActionForComboList:(InfoFieldModel *)model;
- (void)editActionForComboList:(InfoFieldModel *)model atCell:(InfoFieldCell*)cell;

- (void)showVaildationMessage:(NSString *) errorMessage;
@end

@interface InfoFieldCell : UITableViewCell
@property (nonatomic, assign) BOOL                          belongToLoggedInUser;
@property (nonatomic, strong) InfoFieldModel                *fieldModel;
@property (nonatomic, weak) id<InfoEditingDelegate>         delegate;
// Edit string type values
@property (nonatomic, strong) UITextField   *textField;
- (void)startEditingField;
- (void)stopEditingField:(BOOL)returnBtnPressed;
+ (CGFloat)heightWithInfoModel:(InfoFieldModel *)fieldModel
                 withCellWidth:(CGFloat)cellWidth;
- (void)numericValueDoneEditing;


+ (NSString *)dateTimeStringFromModel:(InfoFieldModel *)model;
+ (NSString *)dateStringFromModel:(InfoFieldModel *)model;
+ (NSString *)timeStringFromModel:(InfoFieldModel *)model;
@end
