






#import "SumBothEightCell.h"
#import "BadgeSunIcy.h"
#import "Masonry.h"
#import "UIImage+MidImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+ArtBeacon.h"

@interface SumBothEightCell()


@property (nonatomic,strong) NSString * putFatLogoBar;


@property (nonatomic,strong) UIImageView * didCalciumView;


@property (nonatomic,strong) UILabel * cropPascalLabel;


@property (nonatomic,strong) UILabel * leaseRopeLabel;

@property (nonatomic, strong) UIButton * bitYouButton;

@end

@implementation SumBothEightCell

- (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.didCalciumView = [UIImageView new];
        self.didCalciumView.tintColor = [BadgeSunIcy lemmaBestColor];
        self.didCalciumView.layer.cornerRadius = BadgeSunIcy.greekBlueArt.genderTabSpa;
        [self.contentView addSubview:self.didCalciumView];
        [self.didCalciumView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(BadgeSunIcy.greekBlueArt.introAnyOut);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(BadgeSunIcy.greekBlueArt.sinhaleseAny);
        }];
        
        self.cropPascalLabel = [UILabel new];
        self.cropPascalLabel.font = [UIFont boldSystemFontOfSize:BadgeSunIcy.greekBlueArt.catListPlain];
        self.cropPascalLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.cropPascalLabel];
        
        self.leaseRopeLabel = [UILabel new];
        self.leaseRopeLabel.font = [UIFont boldSystemFontOfSize:BadgeSunIcy.greekBlueArt.streetOneWay];
        self.leaseRopeLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.leaseRopeLabel];
        
        [self.cropPascalLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.didCalciumView.mas_right).offset(BadgeSunIcy.greekBlueArt.ornamentShow);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.leaseRopeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.cropPascalLabel);
            make.top.equalTo(self.cropPascalLabel.mas_bottom).offset(BadgeSunIcy.greekBlueArt.midBoxPhase);
        }];
        
        self.bitYouButton = [[UIButton alloc] init];
        _bitYouButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage indicatedClampingFoggyPrincipalBeginningName:BadgeSunIcy.greekBlueArt.bridgeFilmRedAndZip] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_bitYouButton setBackgroundImage:[UIImage indicatedClampingFoggyPrincipalBeginningName:BadgeSunIcy.greekBlueArt.justifiedBoldShortDetailCloudy] forState: UIControlStateNormal];
        [_bitYouButton setBackgroundImage:image forState: UIControlStateSelected];
        _bitYouButton.tintColor = [BadgeSunIcy lemmaBestColor];
        [self.contentView addSubview:_bitYouButton];
        [_bitYouButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-BadgeSunIcy.greekBlueArt.ornamentShow);
            make.size.mas_equalTo(CGSizeMake(BadgeSunIcy.greekBlueArt.aliveLiteral, BadgeSunIcy.greekBlueArt.aliveLiteral));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _bitYouButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [BadgeSunIcy lemmaBestColor].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 = BadgeSunIcy.greekBlueArt.introAnyOut;
    frame.size.width -= BadgeSunIcy.greekBlueArt.catListPlain;
    frame.origin.y += BadgeSunIcy.greekBlueArt.introAnyOut;
    frame.size.height -= BadgeSunIcy.greekBlueArt.introAnyOut;
    [super setFrame:frame];
    
    self.layer.cornerRadius = frame.size.height / 2.0;
}

-(void)setPutFatLogoBar:(NSString *)putFatLogoBar {
    _putFatLogoBar = putFatLogoBar;
    [self.didCalciumView sd_setImageWithURL:[NSURL URLWithString:putFatLogoBar] placeholderImage:nil];
}

- (void)setWindowFace:(PintBadExtendsUnderSeventeenStrategy *)windowFace {
    _windowFace= windowFace;
    self.putFatLogoBar = windowFace.smoothAre;
    self.cropPascalLabel.text = windowFace.universal;
    NSString *note = windowFace.springRow?:@"";
    if (note.chainPoolTop) {
        self.leaseRopeLabel.hidden = YES;
        [self.cropPascalLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.didCalciumView.mas_right).offset(BadgeSunIcy.greekBlueArt.ornamentShow);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.leaseRopeLabel.hidden = NO;
        NSRange lambda = [note rangeOfString:BadgeSunIcy.greekBlueArt.procedureIllegalBrushEraCommentsPetabytes];
        NSRange gather = [note rangeOfString:BadgeSunIcy.greekBlueArt.slightPatternsAppliesSonPartialError];
        
        if (lambda.length == 0 && gather.length == 0) {
            self.leaseRopeLabel.text = note;
            self.leaseRopeLabel.font = [UIFont systemFontOfSize:BadgeSunIcy.greekBlueArt.streetOneWay];
            self.leaseRopeLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange itsTrack = NSMakeRange(lambda.location+lambda.length, gather.location-(lambda.location+lambda.length));
            NSString *metric = [note substringWithRange:itsTrack];
            NSString *artMust = [note stringByReplacingOccurrencesOfString:BadgeSunIcy.greekBlueArt.procedureIllegalBrushEraCommentsPetabytes withString:@""];
            artMust = [artMust stringByReplacingOccurrencesOfString:BadgeSunIcy.greekBlueArt.slightPatternsAppliesSonPartialError withString:@""];
            
            itsTrack = [artMust rangeOfString:metric];
            NSMutableAttributedString *provinceMath = [[NSMutableAttributedString alloc] initWithString:artMust];
            [provinceMath addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, artMust.length)];
            [provinceMath addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, artMust.length)];
            [provinceMath addAttribute:NSForegroundColorAttributeName value:[BadgeSunIcy lemmaBestColor] range:itsTrack];
            [provinceMath addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:itsTrack];
            
            self.leaseRopeLabel.attributedText = provinceMath;
        }
        
        [self.cropPascalLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.didCalciumView.mas_right).offset(BadgeSunIcy.greekBlueArt.ornamentShow);
            make.top.equalTo(self.didCalciumView).offset(BadgeSunIcy.greekBlueArt.mutationHow);
        }];
    }
}

@end
