//
//  MultipleSelectionView.m
//  TakeTours
//
//  Created by 包光清 on 2019/1/14.
//

#import "MultipleSelectionView.h"
#import "DrawUtils.h"
#import "Vars.h"
#import "CocoaUtils.h"
#import "SDK.h"
#import "Utility.h"
@interface MultipleSelectionView ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIButton *closeButton;
@property (weak, nonatomic) IBOutlet UIButton *clearButton;
@property (weak, nonatomic) IBOutlet UIButton *doneButton;

@end



@implementation MultipleSelectionView
-(void)awakeFromNib{
	[super awakeFromNib];

	[self.clearButton setTintColor:[Vars defaultTintColor]];
	[self.clearButton setBackgroundColor: [UIColor whiteColor]];
	[self.clearButton addTarget:self action:@selector(clearCollect) forControlEvents:UIControlEventTouchUpInside];
	[DrawUtils addRoundedBorderToRect:self.clearButton cornerRadius:5 strokeColor:[UIColor whiteColor]];
	
	[self.doneButton setTintColor:[UIColor whiteColor]];
	[self.doneButton setBackgroundColor: [Vars defaultTintColor]];
	[self.doneButton addTarget:self action:@selector(done) forControlEvents:UIControlEventTouchUpInside];
	[DrawUtils addRoundedBorderToRect:self.doneButton cornerRadius:5 strokeColor:[Vars defaultTintColor]];

	self.titleLabel.text = IMLocalizedString(@"Select Duration Length - days");
	
	
	
}

-(NSMutableArray *)tmpDataArray {
	if (!_tmpDataArray){
		_tmpDataArray = [NSMutableArray array];
	}
	return _tmpDataArray;
}

#pragma mark Event
- (void)clearCollect {
	[self.tmpDataArray removeAllObjects];
	self.reloadContentView(@[]);
}


- (void)done {
	self.backSelectDurationArray([self.tmpDataArray copy]);
}

- (IBAction)closeView {
	[self.tmpDataArray removeAllObjects];
	self.backSelectDurationArray(self.tmpDataArray);
}

@end
