//
//  RulesRegisterViewController.h
//  kneet
//
//  Created by Jason Lee on 3/19/15.
//  Copyright (c) 2015 ntels. All rights reserved.
//

#import "JDViewController.h"

@class RuleModel;
@class RuleDetailModel;
@class PredefinedRuleDetailModel;
@class RulesCreateTableViewCell;

@class CustomButton;
@class CustomTextField;
@class CustomTextField2;

@interface RulesRegisterViewController : JDViewController


#pragma mark - Properties
@property (strong, nonatomic) RuleModel *tmpPredRule;
@property (strong, nonatomic) RuleDetailModel *tmpRuleDetail;
@property (strong, nonatomic) PredefinedRuleDetailModel *tmpPredRuleDetail;

@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet CustomButton *btnComplete;
@property (weak, nonatomic) IBOutlet CustomButton *btnCancel;

#pragma mark - Instance Methods
- (void)addItem:(ItemModel *)item;
- (void)setPredefinedRuleDetail:(PredefinedRuleDetailModel *)predefinedRuleDetail;
- (void)matchRuleDetailWithPredefinedRuleDeatil:(PredefinedRuleDetailModel *)predRuleDetail;

+ (ModeModel *)mode:(NSString *)modeId;
+ (void)setSubItemsFromItem:(NSArray<ItemModel> *)items;
+ (void)appendItem:(NSMutableArray<ItemModel> *)items withPredefinedRuleItems:(NSArray<ItemModel> *)predItems  isRuleMode:(BOOL)isRuleMode;

+ (CGFloat)heightForSubItems:(ItemModel *)item isTrigger:(BOOL)isTrigger;
+ (void)fillCell:(RulesCreateTableViewCell *)cell item:(ItemModel *)item isTrigger:(BOOL)isTrigger;

- (void)btnDeleteSubItemsTouched:(id)sender;

- (IBAction)btnCompleteRuleTouched:(id)sender;
- (IBAction)btnCancelRuleTouched:(id)sender;



@end

@class CustomImageView;
@class CustomLabel;
@class CustomTextView;

@interface RulesCreateHeaderTableViewCell : UITableViewCell

@property (weak, nonatomic) IBOutlet CustomImageView *imgvTop;
@property (weak, nonatomic) IBOutlet CustomLabel *lblHeaderTitle;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintHeaderTitleTop;

@end

@interface RulesCreateTableViewCell : UITableViewCell
@property (weak, nonatomic) NSIndexPath *indexPath;

@property (weak, nonatomic) IBOutlet CustomImageView *imgvItem;
@property (weak, nonatomic) IBOutlet CustomLabel *lblItemName;
@property (weak, nonatomic) IBOutlet CustomLabel *lblSubItems;

@property (weak, nonatomic) IBOutlet CustomImageView *imgvBg;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintImgvBgHeight;

@property (weak, nonatomic) IBOutlet UIView *lineview;
@property (weak, nonatomic) IBOutlet CustomButton *btnDeleteSubItems;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintTitleLabelRight;

- (IBAction)btnDeleteSubItemsTouched:(id)sender;
@end


@interface RulesCreateTitleTableViewCell : UITableViewCell

@property (weak, nonatomic) IBOutlet CustomImageView *imgvItem;
@property (weak, nonatomic) IBOutlet CustomLabel *lblRuleTitle;
@property (weak, nonatomic) IBOutlet CustomTextField2 *txtRuleTitle;

@end
