






#import "VideoDeepHerCell.h"
#import "SkinEchoMen.h"
#import "Masonry.h"
#import "UIImage+FixImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+PintDatum.h"

@interface VideoDeepHerCell()


@property (nonatomic,strong) NSString * plateDetailed;


@property (nonatomic,strong) UIImageView * wasCatalanView;


@property (nonatomic,strong) UILabel * hiddenRowsLabel;


@property (nonatomic,strong) UILabel * universalLabel;

@property (nonatomic, strong) UIButton * sheSinButton;

@end

@implementation VideoDeepHerCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = UIColor.clearColor;
        self.contentView.backgroundColor = UIColor.clearColor;
        
        self.wasCatalanView = [UIImageView new];
        self.wasCatalanView.tintColor = [SkinEchoMen panoramasColor];
        self.wasCatalanView.layer.cornerRadius = SkinEchoMen.pauseKirghiz.artsIndexFor;
        [self.contentView addSubview:self.wasCatalanView];
        [self.wasCatalanView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(SkinEchoMen.pauseKirghiz.thickArtery);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(SkinEchoMen.pauseKirghiz.subjectYears);
        }];
        
        self.hiddenRowsLabel = [UILabel new];
        self.hiddenRowsLabel.font = [UIFont boldSystemFontOfSize:SkinEchoMen.pauseKirghiz.napMaskTrack];
        self.hiddenRowsLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.hiddenRowsLabel];
        
        self.universalLabel = [UILabel new];
        self.universalLabel.font = [UIFont boldSystemFontOfSize:SkinEchoMen.pauseKirghiz.outExtrasWon];
        self.universalLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.universalLabel];
        
        [self.hiddenRowsLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.wasCatalanView.mas_right).offset(SkinEchoMen.pauseKirghiz.slovakFunDog);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.universalLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.hiddenRowsLabel);
            make.top.equalTo(self.hiddenRowsLabel.mas_bottom).offset(SkinEchoMen.pauseKirghiz.reorderStop);
        }];
        
        self.sheSinButton = [[UIButton alloc] init];
        _sheSinButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage intentIcelandicGaspSwipeBarName:SkinEchoMen.pauseKirghiz.statementPackInfinityOperationIts] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_sheSinButton setBackgroundImage:[UIImage intentIcelandicGaspSwipeBarName:SkinEchoMen.pauseKirghiz.reloadAnimatingDirectorHeapAccepting] forState: UIControlStateNormal];
        [_sheSinButton setBackgroundImage:image forState: UIControlStateSelected];
        _sheSinButton.tintColor = [SkinEchoMen panoramasColor];
        [self.contentView addSubview:_sheSinButton];
        [_sheSinButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-SkinEchoMen.pauseKirghiz.slovakFunDog);
            make.size.mas_equalTo(CGSizeMake(SkinEchoMen.pauseKirghiz.duplexPashto, SkinEchoMen.pauseKirghiz.duplexPashto));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _sheSinButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [SkinEchoMen panoramasColor].CGColor;
    
    if (selected) {
        self.contentView.backgroundColor = [UIColor colorWithRed:1.0 green:0.98 blue:0.94 alpha:0.95];
    } else {
        self.contentView.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.35];
    }
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = SkinEchoMen.pauseKirghiz.thickArtery;
    frame.size.width -= SkinEchoMen.pauseKirghiz.napMaskTrack;
    frame.origin.y += SkinEchoMen.pauseKirghiz.thickArtery;
    frame.size.height -= SkinEchoMen.pauseKirghiz.thickArtery;
    [super setFrame:frame];
    
    self.layer.cornerRadius = frame.size.height / 2.0;
}

-(void)setPlateDetailed:(NSString *)plateDetailed {
    _plateDetailed = plateDetailed;
    [self.wasCatalanView sd_setImageWithURL:[NSURL URLWithString:plateDetailed] placeholderImage:nil];
}

- (void)setKitBusFace:(InitiallyAirlineParserArabicEndReduction *)kitBusFace {
    _kitBusFace= kitBusFace;
    self.plateDetailed = kitBusFace.photoFlip;
    self.hiddenRowsLabel.text = kitBusFace.bedSuffix;
    NSString *note = kitBusFace.speakStop?:@"";
    if (note.decibelPitch) {
        self.universalLabel.hidden = YES;
        [self.hiddenRowsLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.wasCatalanView.mas_right).offset(SkinEchoMen.pauseKirghiz.slovakFunDog);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.universalLabel.hidden = NO;
        NSRange global = [note rangeOfString:SkinEchoMen.pauseKirghiz.sequencerKashmiriExecPendingAnyCenter];
        NSRange butHer = [note rangeOfString:SkinEchoMen.pauseKirghiz.usabilityHandlesLeapDogUplinkLayer];
        
        if (global.length == 0 && butHer.length == 0) {
            self.universalLabel.text = note;
            self.universalLabel.font = [UIFont systemFontOfSize:SkinEchoMen.pauseKirghiz.outExtrasWon];
            self.universalLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange bagPitch = NSMakeRange(global.location+global.length, butHer.location-(global.location+global.length));
            NSString *jobNow = [note substringWithRange:bagPitch];
            NSString *pairBit = [note stringByReplacingOccurrencesOfString:SkinEchoMen.pauseKirghiz.sequencerKashmiriExecPendingAnyCenter withString:@""];
            pairBit = [pairBit stringByReplacingOccurrencesOfString:SkinEchoMen.pauseKirghiz.usabilityHandlesLeapDogUplinkLayer withString:@""];
            
            bagPitch = [pairBit rangeOfString:jobNow];
            NSMutableAttributedString *taggerInvert = [[NSMutableAttributedString alloc] initWithString:pairBit];
            [taggerInvert addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, pairBit.length)];
            [taggerInvert addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, pairBit.length)];
            [taggerInvert addAttribute:NSForegroundColorAttributeName value:[SkinEchoMen panoramasColor] range:bagPitch];
            [taggerInvert addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:bagPitch];
            
            self.universalLabel.attributedText = taggerInvert;
        }
        
        [self.hiddenRowsLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.wasCatalanView.mas_right).offset(SkinEchoMen.pauseKirghiz.slovakFunDog);
            make.top.equalTo(self.wasCatalanView).offset(SkinEchoMen.pauseKirghiz.manMagicWin);
        }];
    }
}

@end
