






#import "BinNeverAxesCell.h"
#import "OutTapPlain.h"
#import "Masonry.h"
#import "UIImage+JobImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+EvictFile.h"

@interface BinNeverAxesCell()


@property (nonatomic,strong) NSString * disableRemove;


@property (nonatomic,strong) UIImageView * placePatchView;


@property (nonatomic,strong) UILabel * anyMidLeftLabel;


@property (nonatomic,strong) UILabel * vectorTooLabel;

@property (nonatomic, strong) UIButton * bedSexButton;

@end

@implementation BinNeverAxesCell

- (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.placePatchView = [UIImageView new];
        self.placePatchView.tintColor = [OutTapPlain bagOuncesColor];
        self.placePatchView.layer.cornerRadius = OutTapPlain.parentMixMay.tipOptAscent;
        [self.contentView addSubview:self.placePatchView];
        [self.placePatchView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(OutTapPlain.parentMixMay.boundIndian);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(OutTapPlain.parentMixMay.outletModule);
        }];
        
        self.anyMidLeftLabel = [UILabel new];
        self.anyMidLeftLabel.font = [UIFont boldSystemFontOfSize:OutTapPlain.parentMixMay.askForCreate];
        self.anyMidLeftLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.anyMidLeftLabel];
        
        self.vectorTooLabel = [UILabel new];
        self.vectorTooLabel.font = [UIFont boldSystemFontOfSize:OutTapPlain.parentMixMay.siteBreaking];
        self.vectorTooLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.vectorTooLabel];
        
        [self.anyMidLeftLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.placePatchView.mas_right).offset(OutTapPlain.parentMixMay.gaussianOver);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.vectorTooLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.anyMidLeftLabel);
            make.top.equalTo(self.anyMidLeftLabel.mas_bottom).offset(OutTapPlain.parentMixMay.kitChromium);
        }];
        
        self.bedSexButton = [[UIButton alloc] init];
        _bedSexButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage sumEstimatedHandMenstrualPanName:OutTapPlain.parentMixMay.earVectorMindfulHailLicense] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_bedSexButton setBackgroundImage:[UIImage sumEstimatedHandMenstrualPanName:OutTapPlain.parentMixMay.visibleVolatileHeartbeatKitModerate] forState: UIControlStateNormal];
        [_bedSexButton setBackgroundImage:image forState: UIControlStateSelected];
        _bedSexButton.tintColor = [OutTapPlain bagOuncesColor];
        [self.contentView addSubview:_bedSexButton];
        [_bedSexButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-OutTapPlain.parentMixMay.gaussianOver);
            make.size.mas_equalTo(CGSizeMake(OutTapPlain.parentMixMay.twoSmoothing, OutTapPlain.parentMixMay.twoSmoothing));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _bedSexButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [OutTapPlain bagOuncesColor].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 = OutTapPlain.parentMixMay.boundIndian;
    frame.size.width -= OutTapPlain.parentMixMay.askForCreate;
    frame.origin.y += OutTapPlain.parentMixMay.boundIndian;
    frame.size.height -= OutTapPlain.parentMixMay.boundIndian;
    [super setFrame:frame];
    
    self.layer.cornerRadius = frame.size.height / 2.0;
}

-(void)setDisableRemove:(NSString *)disableRemove {
    _disableRemove = disableRemove;
    [self.placePatchView sd_setImageWithURL:[NSURL URLWithString:disableRemove] placeholderImage:nil];
}

- (void)setAddWorkSun:(DialogProducedNapControlInsertingOur *)addWorkSun {
    _addWorkSun= addWorkSun;
    self.disableRemove = addWorkSun.execution;
    self.anyMidLeftLabel.text = addWorkSun.gainWatch;
    NSString *note = addWorkSun.sortCross?:@"";
    if (note.twoWonBypass) {
        self.vectorTooLabel.hidden = YES;
        [self.anyMidLeftLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.placePatchView.mas_right).offset(OutTapPlain.parentMixMay.gaussianOver);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.vectorTooLabel.hidden = NO;
        NSRange sexual = [note rangeOfString:OutTapPlain.parentMixMay.airCancelsSemicolonRightChlorideHue];
        NSRange tooSun = [note rangeOfString:OutTapPlain.parentMixMay.exactFallbackActivateSoftJoinReclaim];
        
        if (sexual.length == 0 && tooSun.length == 0) {
            self.vectorTooLabel.text = note;
            self.vectorTooLabel.font = [UIFont systemFontOfSize:OutTapPlain.parentMixMay.siteBreaking];
            self.vectorTooLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange pinchTop = NSMakeRange(sexual.location+sexual.length, tooSun.location-(sexual.location+sexual.length));
            NSString *wayCar = [note substringWithRange:pinchTop];
            NSString *joining = [note stringByReplacingOccurrencesOfString:OutTapPlain.parentMixMay.airCancelsSemicolonRightChlorideHue withString:@""];
            joining = [joining stringByReplacingOccurrencesOfString:OutTapPlain.parentMixMay.exactFallbackActivateSoftJoinReclaim withString:@""];
            
            pinchTop = [joining rangeOfString:wayCar];
            NSMutableAttributedString *viewInuitHex = [[NSMutableAttributedString alloc] initWithString:joining];
            [viewInuitHex addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, joining.length)];
            [viewInuitHex addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, joining.length)];
            [viewInuitHex addAttribute:NSForegroundColorAttributeName value:[OutTapPlain bagOuncesColor] range:pinchTop];
            [viewInuitHex addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:pinchTop];
            
            self.vectorTooLabel.attributedText = viewInuitHex;
        }
        
        [self.anyMidLeftLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.placePatchView.mas_right).offset(OutTapPlain.parentMixMay.gaussianOver);
            make.top.equalTo(self.placePatchView).offset(OutTapPlain.parentMixMay.endPinBegan);
        }];
    }
}

@end
