






#import "StairBankersCell.h"
#import "ForHueAfter.h"
#import "Masonry.h"
#import "UIImage+GetImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+RankRetry.h"

@interface StairBankersCell()


@property (nonatomic,strong) NSString * soloBlinkBeen;


@property (nonatomic,strong) UIImageView * capBitSnowView;


@property (nonatomic,strong) UILabel * ownArtsUseLabel;


@property (nonatomic,strong) UILabel * darkRetryLabel;

@property (nonatomic, strong) UIButton * reloadButton;

@end

@implementation StairBankersCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = ForHueAfter.grayGradient.maxAlphaSon;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.capBitSnowView = [UIImageView new];
        self.capBitSnowView.tintColor = [ForHueAfter requiringColor];
        self.capBitSnowView.layer.cornerRadius = ForHueAfter.grayGradient.panKelvinCap;
        [self.contentView addSubview:self.capBitSnowView];
        [self.capBitSnowView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(ForHueAfter.grayGradient.nowNineteen);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(ForHueAfter.grayGradient.mailArrowOff);
        }];
        
        self.ownArtsUseLabel = [UILabel new];
        self.ownArtsUseLabel.font = [UIFont boldSystemFontOfSize:ForHueAfter.grayGradient.degreesLeave];
        self.ownArtsUseLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.ownArtsUseLabel];
        
        self.darkRetryLabel = [UILabel new];
        self.darkRetryLabel.font = [UIFont boldSystemFontOfSize:ForHueAfter.grayGradient.kernelPopBig];
        self.darkRetryLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.darkRetryLabel];
        
        [self.ownArtsUseLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.capBitSnowView.mas_right).offset(ForHueAfter.grayGradient.submitTopAnd);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.darkRetryLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.ownArtsUseLabel);
            make.top.equalTo(self.ownArtsUseLabel.mas_bottom).offset(ForHueAfter.grayGradient.mayLinearly);
        }];
        
        self.reloadButton = [[UIButton alloc] init];
        _reloadButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage thousandClipUnchangedPortionSelectedName:ForHueAfter.grayGradient.axialEnhanceAmbiguousDayCap] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_reloadButton setBackgroundImage:[UIImage thousandClipUnchangedPortionSelectedName:ForHueAfter.grayGradient.cocoaVeryThreeDarkRelevance] forState: UIControlStateNormal];
        [_reloadButton setBackgroundImage:image forState: UIControlStateSelected];
        _reloadButton.tintColor = [ForHueAfter requiringColor];
        [self.contentView addSubview:_reloadButton];
        [_reloadButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-ForHueAfter.grayGradient.submitTopAnd);
            make.size.mas_equalTo(CGSizeMake(ForHueAfter.grayGradient.cleanDarkEye, ForHueAfter.grayGradient.cleanDarkEye));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _reloadButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [ForHueAfter requiringColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = ForHueAfter.grayGradient.nowNineteen;
    frame.size.width -= ForHueAfter.grayGradient.degreesLeave;
    frame.origin.y += ForHueAfter.grayGradient.nowNineteen;
    frame.size.height -= ForHueAfter.grayGradient.nowNineteen;
    [super setFrame:frame];
}

-(void)setSoloBlinkBeen:(NSString *)soloBlinkBeen {
    _soloBlinkBeen = soloBlinkBeen;
    [self.capBitSnowView sd_setImageWithURL:[NSURL URLWithString:soloBlinkBeen] placeholderImage:nil];
}

- (void)setNetHintIll:(PersonMaxAddScrollsWireWas *)netHintIll {
    _netHintIll= netHintIll;
    self.soloBlinkBeen = netHintIll.easyThumb;
    self.ownArtsUseLabel.text = netHintIll.rareParse;
    NSString *note = netHintIll.germanAdd?:@"";
    if (note.handReplyMix) {
        self.darkRetryLabel.hidden = YES;
        [self.ownArtsUseLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.capBitSnowView.mas_right).offset(ForHueAfter.grayGradient.submitTopAnd);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.darkRetryLabel.hidden = NO;
        NSRange hitTag = [note rangeOfString:ForHueAfter.grayGradient.rainRetTallKeepCapPresent];
        NSRange suffix = [note rangeOfString:ForHueAfter.grayGradient.finderPoloPrintedAscendedMarqueeGlobally];
        
        if (hitTag.length == 0 && suffix.length == 0) {
            self.darkRetryLabel.text = note;
            self.darkRetryLabel.font = [UIFont systemFontOfSize:ForHueAfter.grayGradient.kernelPopBig];
            self.darkRetryLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange pivotSpa = NSMakeRange(hitTag.location+hitTag.length, suffix.location-(hitTag.location+hitTag.length));
            NSString *master = [note substringWithRange:pivotSpa];
            NSString *revoked = [note stringByReplacingOccurrencesOfString:ForHueAfter.grayGradient.rainRetTallKeepCapPresent withString:@""];
            revoked = [revoked stringByReplacingOccurrencesOfString:ForHueAfter.grayGradient.finderPoloPrintedAscendedMarqueeGlobally withString:@""];
            
            pivotSpa = [revoked rangeOfString:master];
            NSMutableAttributedString *activeSoccer = [[NSMutableAttributedString alloc] initWithString:revoked];
            [activeSoccer addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, revoked.length)];
            [activeSoccer addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, revoked.length)];
            [activeSoccer addAttribute:NSForegroundColorAttributeName value:[ForHueAfter requiringColor] range:pivotSpa];
            [activeSoccer addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:pivotSpa];
            
            self.darkRetryLabel.attributedText = activeSoccer;
        }
        
        [self.ownArtsUseLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.capBitSnowView.mas_right).offset(ForHueAfter.grayGradient.submitTopAnd);
            make.top.equalTo(self.capBitSnowView).offset(ForHueAfter.grayGradient.armQueryAdd);
        }];
    }
}

@end
