






#import "SixCaseSugarCell.h"
#import "AreStateWon.h"
#import "Masonry.h"
#import "UIImage+OldImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+LessSeven.h"

@interface SixCaseSugarCell()


@property (nonatomic,strong) NSString * tiedTooFaxLow;


@property (nonatomic,strong) UIImageView * illCharOffView;


@property (nonatomic,strong) UILabel * busOldFlipLabel;


@property (nonatomic,strong) UILabel * volumeManLabel;

@property (nonatomic, strong) UIButton * safariButton;

@end

@implementation SixCaseSugarCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = AreStateWon.twoHoverHard.symbolTilde;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.illCharOffView = [UIImageView new];
        self.illCharOffView.tintColor = [AreStateWon spanFloatColor];
        self.illCharOffView.layer.cornerRadius = AreStateWon.twoHoverHard.sinWireNoise;
        [self.contentView addSubview:self.illCharOffView];
        [self.illCharOffView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(AreStateWon.twoHoverHard.agePoloBoth);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(AreStateWon.twoHoverHard.useFitFilter);
        }];
        
        self.busOldFlipLabel = [UILabel new];
        self.busOldFlipLabel.font = [UIFont boldSystemFontOfSize:AreStateWon.twoHoverHard.armourOldBig];
        self.busOldFlipLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.busOldFlipLabel];
        
        self.volumeManLabel = [UILabel new];
        self.volumeManLabel.font = [UIFont boldSystemFontOfSize:AreStateWon.twoHoverHard.collapsesSpa];
        self.volumeManLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.volumeManLabel];
        
        [self.busOldFlipLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.illCharOffView.mas_right).offset(AreStateWon.twoHoverHard.knowShapeSay);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.volumeManLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.busOldFlipLabel);
            make.top.equalTo(self.busOldFlipLabel.mas_bottom).offset(AreStateWon.twoHoverHard.areSpaTeeth);
        }];
        
        self.safariButton = [[UIButton alloc] init];
        _safariButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage bikeSpaceTurnProtocolsPencilName:AreStateWon.twoHoverHard.allergyOccurredGlobalCricketCategory] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_safariButton setBackgroundImage:[UIImage bikeSpaceTurnProtocolsPencilName:AreStateWon.twoHoverHard.menstrualPlacementTerahertzGlyphHandshake] forState: UIControlStateNormal];
        [_safariButton setBackgroundImage:image forState: UIControlStateSelected];
        _safariButton.tintColor = [AreStateWon spanFloatColor];
        [self.contentView addSubview:_safariButton];
        [_safariButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-AreStateWon.twoHoverHard.knowShapeSay);
            make.size.mas_equalTo(CGSizeMake(AreStateWon.twoHoverHard.spanExistSub, AreStateWon.twoHoverHard.spanExistSub));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _safariButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [AreStateWon spanFloatColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = AreStateWon.twoHoverHard.agePoloBoth;
    frame.size.width -= AreStateWon.twoHoverHard.armourOldBig;
    frame.origin.y += AreStateWon.twoHoverHard.agePoloBoth;
    frame.size.height -= AreStateWon.twoHoverHard.agePoloBoth;
    [super setFrame:frame];
}

-(void)setTiedTooFaxLow:(NSString *)tiedTooFaxLow {
    _tiedTooFaxLow = tiedTooFaxLow;
    [self.illCharOffView sd_setImageWithURL:[NSURL URLWithString:tiedTooFaxLow] placeholderImage:nil];
}

- (void)setHisArtNine:(SafeShortAffineAreEffectDash *)hisArtNine {
    _hisArtNine= hisArtNine;
    self.tiedTooFaxLow = hisArtNine.lazyLeast;
    self.busOldFlipLabel.text = hisArtNine.unablePan;
    NSString *note = hisArtNine.thickBurn?:@"";
    if (note.composerNext) {
        self.volumeManLabel.hidden = YES;
        [self.busOldFlipLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.illCharOffView.mas_right).offset(AreStateWon.twoHoverHard.knowShapeSay);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.volumeManLabel.hidden = NO;
        NSRange finder = [note rangeOfString:AreStateWon.twoHoverHard.affinityCollapsedMarathiScriptSafeQualifier];
        NSRange sunMay = [note rangeOfString:AreStateWon.twoHoverHard.privilegeFarReceivingSheReferentDomains];
        
        if (finder.length == 0 && sunMay.length == 0) {
            self.volumeManLabel.text = note;
            self.volumeManLabel.font = [UIFont systemFontOfSize:AreStateWon.twoHoverHard.collapsesSpa];
            self.volumeManLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange midRoute = NSMakeRange(finder.location+finder.length, sunMay.location-(finder.location+finder.length));
            NSString *dueTip = [note substringWithRange:midRoute];
            NSString *removal = [note stringByReplacingOccurrencesOfString:AreStateWon.twoHoverHard.affinityCollapsedMarathiScriptSafeQualifier withString:@""];
            removal = [removal stringByReplacingOccurrencesOfString:AreStateWon.twoHoverHard.privilegeFarReceivingSheReferentDomains withString:@""];
            
            midRoute = [removal rangeOfString:dueTip];
            NSMutableAttributedString *boxSpecified = [[NSMutableAttributedString alloc] initWithString:removal];
            [boxSpecified addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, removal.length)];
            [boxSpecified addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, removal.length)];
            [boxSpecified addAttribute:NSForegroundColorAttributeName value:[AreStateWon spanFloatColor] range:midRoute];
            [boxSpecified addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:midRoute];
            
            self.volumeManLabel.attributedText = boxSpecified;
        }
        
        [self.busOldFlipLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.illCharOffView.mas_right).offset(AreStateWon.twoHoverHard.knowShapeSay);
            make.top.equalTo(self.illCharOffView).offset(AreStateWon.twoHoverHard.netFoodShot);
        }];
    }
}

@end
