//
// TourSearchBusStopCell.m
// Project
//
// Created by Ziv on 16/3/30.
//
//

#import "TourSearchBusStopCell.h"
#import "SDK.h"
#import "DrawUtils.h"
#import "Vars.h"

@interface TourSearchBusStopCell ()
@property (nonatomic, weak) IBOutlet UILabel *locationTitle;
@property (nonatomic, weak) IBOutlet UILabel *addressTitle;
@property (nonatomic, weak) IBOutlet UILabel *departureTitle;
@property (nonatomic, weak) IBOutlet UILabel *returnTitle;
@property (nonatomic, weak) IBOutlet UILabel *departureColon;
@property (nonatomic, weak) IBOutlet UILabel *returnColon;
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *returnBottomConstraint;
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *addressBottomConstraint;
@end

@implementation TourSearchBusStopCell

- (void)awakeFromNib {
	[super awakeFromNib];
	// Initialization code
	self.locationTitle.text = [Vars is_cn_website] ? IMLocalizedString(@"Tour City") : @"Location";
	self.addressTitle.text = [Vars is_cn_website] ? IMLocalizedString(@"Departure Address") : @"Address";
	self.departureTitle.text = [Vars is_cn_website] ? IMLocalizedString(@"Departure Time") : @"Departure";
	self.returnTitle.text = [Vars is_cn_website] ? IMLocalizedString(@"Return Time") : @"Return";

	self.accessoryView = [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[FAKFontAwesome mapMarkerIconWithSize:24] fillColor:[Vars defaultTintColor]]];
}

- (void)hidenDepartureAndReturn {
	self.departureTitle.hidden = YES;
	self.returnTitle.hidden = YES;
	self.departureColon.hidden = YES;
	self.returnColon.hidden = YES;
	self.departureLabel.hidden = YES;
	self.returnLabel.hidden = YES;
	self.returnBottomConstraint.priority = 1;
	self.addressBottomConstraint.priority = UILayoutPriorityRequired - 1;
}

- (void)showDepartureAndReturn {
	self.departureTitle.hidden = NO;
	self.returnTitle.hidden = NO;
	self.departureColon.hidden = NO;
	self.returnColon.hidden = NO;
	self.departureLabel.hidden = NO;
	self.returnLabel.hidden = NO;
	self.returnBottomConstraint.priority = UILayoutPriorityRequired - 1;
	self.addressBottomConstraint.priority = 1;
}

@end
