//
//  LogisticsTimeLineTableViewCell.m
//  ALand
//
//  Created by Javen on 16/8/29.
//  Copyright © 2016年 Z. All rights reserved.
//

#import "LogisticsTimeLineTableViewCell.h"
#import "LogisticsItemsModel.h"

@interface LogisticsTimeLineTableViewCell ()
/** 上面的灰线 */
@property (weak, nonatomic) IBOutlet UIView *upLIne;
/** 下面的灰线 */
@property (weak, nonatomic) IBOutlet UIView *downLine;
/** 时间 */
@property (weak, nonatomic) IBOutlet UILabel *time;
/** 物流信息 */
@property (weak, nonatomic) IBOutlet UILabel *LogisticsInfo;
/** 小闹钟图标 */
@property (weak, nonatomic) IBOutlet UIImageView *imgClock;
@end
@implementation LogisticsTimeLineTableViewCell

- (void)awakeFromNib {
    // Initialization code
}



- (void)configCellWithArr:(id)array index:(NSIndexPath *)indexPath {
    LogisticsItemsModel *model = array[indexPath.row];
    self.time.text = SAFE_STRING(model.operTime);
    self.LogisticsInfo.text = model.internalBaseClassDescription;
    if (indexPath.row == 0) {
        self.type = LogisticsLineTypeTop;
    }else if (indexPath.row + 1 == [array count]){
        self.type = LogisticsLineTypeBottom;
    }else{
        self.type = LogisticsLineTypeCenter;
    }
}

/**
 *  根据类型设置cell的样式
 *
 *  @param type 类型
 */
- (void)setType:(LogisticsLineType)type {
    switch (type) {
        case LogisticsLineTypeTop: {
            self.upLIne.hidden = YES;
            self.imgClock.highlighted = NO;
            self.downLine.hidden = NO;
            self.time.textColor = kCustomGreenColor;
            self.LogisticsInfo.textColor = kCustomGreenColor;
            break;
        }
        case LogisticsLineTypeCenter: {
            self.upLIne.hidden = NO;
            self.imgClock.highlighted = YES;
            self.downLine.hidden = NO;
            self.time.textColor = [UIColor grayColor];
            self.LogisticsInfo.textColor = [UIColor grayColor];
            break;
        }
        case LogisticsLineTypeBottom: {
            self.upLIne.hidden = NO;
            self.imgClock.highlighted = YES;
            self.downLine.hidden = YES;
            self.time.textColor = [UIColor grayColor];
            self.LogisticsInfo.textColor = [UIColor grayColor];
            break;
        }
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
