//
//  BusStatusDetailStopView.m
//  Project
//
//  Created by Vae on 2018/6/11.
//

#import "BusStatusDetailStopView.h"
#import "SDK.h"
#import "DrawUtils.h"
#import "ImageUtils.h"
#import "UIConstants.h"
#import "UniversalViewWrapper.h"
#import "Vars.h"
@interface BusStatusDetailStopView()
@property (weak, nonatomic) IBOutlet UIStackView *bottomToolBarView;
@property (weak, nonatomic) IBOutlet UIStackView *toolBarView;
@property (weak, nonatomic) IBOutlet UIView *spaceView;

@end

@implementation BusStatusDetailStopView
- (void)awakeFromNib {
    [super awakeFromNib];
    
    [DrawUtils addSolidBorderToRect:self.pickUpButton strokeColor:[UIColor silverColor]];
    self.pickUpButton.backgroundColor = [UIColor mercuryColor];
    [self.pickUpButton setImage:[DrawUtils imageWithFAKIcon:[FAKFontAwesome levelUpIconWithSize:self.pickUpButton.titleLabel.font.pointSize] fillColor:[UIColor lightGrayColor]] forState:UIControlStateNormal];
    
    [DrawUtils addSolidBorderToRect:self.checkInButton strokeColor:[UIColor silverColor]];
    self.checkInButton.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 5/2);
    self.checkInButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5/2, 0, 0);
    [self.checkInButton setImage:[ImageUtils scaleImage:[UIImage imageNamed:@"icon_bus_boarding_yes"] toWidth:self.checkInButton.titleLabel.font.pointSize] forState:UIControlStateNormal];
    
    [DrawUtils addSolidBorderToRect:self.uncheckedButton strokeColor:[UIColor silverColor]];
    self.uncheckedButton.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 5/2);
    self.uncheckedButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5/2, 0, 0);
    [self.uncheckedButton setImage:[ImageUtils scaleImage:[UIImage imageNamed:@"icon_bus_boarding_no"] toWidth:self.uncheckedButton.titleLabel.font.pointSize] forState:UIControlStateNormal];
    
    [DrawUtils addSolidBorderToRect:self.dropOffButton strokeColor:[UIColor silverColor]];
    self.dropOffButton.backgroundColor = [UIColor mercuryColor];
    [self.dropOffButton setImage:[DrawUtils imageWithFAKIcon:[FAKFontAwesome levelDownIconWithSize:self.dropOffButton.titleLabel.font.pointSize] fillColor:[UIColor lightGrayColor]] forState:UIControlStateNormal];
    
    [self adjustBottomToolBarButton:self.driverInfoButton];
    [self adjustBottomToolBarButton:self.cashTicketButton];
    [self adjustBottomToolBarButton:self.scanQRCodeButton];
}

-(void)adjustBottomToolBarButton:(UIButton *)button{
    [DrawUtils addSolidBorderToRect:button strokeColor:[UIColor silverColor]];
    [DrawUtils inscribeOvalToRect:button strokeColor:[UIColor silverColor]];
    [button setContentEdgeInsets:UIEdgeInsetsMake(3, 5, 3, 5)];
}

-(void)setIsPickUp:(BOOL)isPickUp{
    _isPickUp = isPickUp;
    if (_isPickUp) {
        self.pickUpButton.hidden = NO;
        self.checkInButton.hidden = NO;
        self.uncheckedButton.hidden = NO;
        self.spaceView.hidden = NO;
    } else {
        self.pickUpButton.hidden = YES;
        self.checkInButton.hidden = YES;
        self.uncheckedButton.hidden = YES;
        self.spaceView.hidden = YES;
	
    }
}

- (void)setIsDropOff:(BOOL)isDropOff{
    _isDropOff = isDropOff;
    if (isDropOff) {
        self.dropOffButton.hidden = NO;
    }else{
        self.dropOffButton.hidden = YES;
    }
}

-(void)setHidesStatusTime:(BOOL)hidesStatusTime{
    _hidesStatusTime = hidesStatusTime;
    if (_hidesStatusTime) {
        self.statusTimeLabel.hidden = YES;
    } else {
        self.statusTimeLabel.hidden = NO;
    }
}

-(void)setShowsToolbar:(BOOL)showsToolbar{
    _showsToolbar = showsToolbar;
    if (_showsToolbar) {
        self.toolBarView.hidden = NO;
    } else {
        self.toolBarView.hidden = YES;
    }
}

- (void)setShowBottomToolbar:(BOOL)showBottomToolbar{
    _showBottomToolbar = showBottomToolbar;
    if (_showBottomToolbar) {
        self.bottomToolBarView.hidden = NO;
    }else{
        self.bottomToolBarView.hidden = YES;
    }
}


@end
