






#import "AboveNodeTenCell.h"
#import "BigAddition.h"
#import "Masonry.h"
#import "UIImage+MidImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+MoreAlien.h"

@interface AboveNodeTenCell()


@property (nonatomic,strong) NSString * irishTakeHead;


@property (nonatomic,strong) UIImageView * middlePoloView;


@property (nonatomic,strong) UILabel * twoMainMapLabel;


@property (nonatomic,strong) UILabel * cardSmartLabel;

@property (nonatomic, strong) UIButton * catRawButton;

@end

@implementation AboveNodeTenCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = BigAddition.noiseFactMen.noteCallBut;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.middlePoloView = [UIImageView new];
        self.middlePoloView.tintColor = [BigAddition portHumanColor];
        self.middlePoloView.layer.cornerRadius = BigAddition.noiseFactMen.ditherMetric;
        [self.contentView addSubview:self.middlePoloView];
        [self.middlePoloView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(BigAddition.noiseFactMen.tempRetMenu);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(BigAddition.noiseFactMen.dogTheNative);
        }];
        
        self.twoMainMapLabel = [UILabel new];
        self.twoMainMapLabel.font = [UIFont boldSystemFontOfSize:BigAddition.noiseFactMen.entryPalette];
        self.twoMainMapLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.twoMainMapLabel];
        
        self.cardSmartLabel = [UILabel new];
        self.cardSmartLabel.font = [UIFont boldSystemFontOfSize:BigAddition.noiseFactMen.somaliAccept];
        self.cardSmartLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.cardSmartLabel];
        
        [self.twoMainMapLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.middlePoloView.mas_right).offset(BigAddition.noiseFactMen.lossArranged);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.cardSmartLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.twoMainMapLabel);
            make.top.equalTo(self.twoMainMapLabel.mas_bottom).offset(BigAddition.noiseFactMen.parseIcyAdd);
        }];
        
        self.catRawButton = [[UIButton alloc] init];
        _catRawButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage spaNumbersDayPowerRhythmName:BigAddition.noiseFactMen.allocatedBuffersChooseWonDeleting] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_catRawButton setBackgroundImage:[UIImage spaNumbersDayPowerRhythmName:BigAddition.noiseFactMen.moleGenerateHectaresBigKey] forState: UIControlStateNormal];
        [_catRawButton setBackgroundImage:image forState: UIControlStateSelected];
        _catRawButton.tintColor = [BigAddition portHumanColor];
        [self.contentView addSubview:_catRawButton];
        [_catRawButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-BigAddition.noiseFactMen.lossArranged);
            make.size.mas_equalTo(CGSizeMake(BigAddition.noiseFactMen.possiblePlan, BigAddition.noiseFactMen.possiblePlan));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _catRawButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [BigAddition portHumanColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = BigAddition.noiseFactMen.tempRetMenu;
    frame.size.width -= BigAddition.noiseFactMen.entryPalette;
    frame.origin.y += BigAddition.noiseFactMen.tempRetMenu;
    frame.size.height -= BigAddition.noiseFactMen.tempRetMenu;
    [super setFrame:frame];
}

-(void)setIrishTakeHead:(NSString *)irishTakeHead {
    _irishTakeHead = irishTakeHead;
    [self.middlePoloView sd_setImageWithURL:[NSURL URLWithString:irishTakeHead] placeholderImage:nil];
}

- (void)setLawMileIll:(SexOpenCarTalkRopeQuerying *)lawMileIll {
    _lawMileIll= lawMileIll;
    self.irishTakeHead = lawMileIll.swapQuick;
    self.twoMainMapLabel.text = lawMileIll.legacyPin;
    NSString *note = lawMileIll.sexualPop?:@"";
    if (note.tradFetchShe) {
        self.cardSmartLabel.hidden = YES;
        [self.twoMainMapLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.middlePoloView.mas_right).offset(BigAddition.noiseFactMen.lossArranged);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.cardSmartLabel.hidden = NO;
        NSRange airMay = [note rangeOfString:BigAddition.noiseFactMen.ownDisorderScriptWrapQuietChat];
        NSRange andKin = [note rangeOfString:BigAddition.noiseFactMen.cutCapFlippedBeaconsSkinMouse];
        
        if (airMay.length == 0 && andKin.length == 0) {
            self.cardSmartLabel.text = note;
            self.cardSmartLabel.font = [UIFont systemFontOfSize:BigAddition.noiseFactMen.somaliAccept];
            self.cardSmartLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange drumTask = NSMakeRange(airMay.location+airMay.length, andKin.location-(airMay.location+airMay.length));
            NSString *addIll = [note substringWithRange:drumTask];
            NSString *halfAnd = [note stringByReplacingOccurrencesOfString:BigAddition.noiseFactMen.ownDisorderScriptWrapQuietChat withString:@""];
            halfAnd = [halfAnd stringByReplacingOccurrencesOfString:BigAddition.noiseFactMen.cutCapFlippedBeaconsSkinMouse withString:@""];
            
            drumTask = [halfAnd rangeOfString:addIll];
            NSMutableAttributedString *musicAdjusts = [[NSMutableAttributedString alloc] initWithString:halfAnd];
            [musicAdjusts addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, halfAnd.length)];
            [musicAdjusts addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, halfAnd.length)];
            [musicAdjusts addAttribute:NSForegroundColorAttributeName value:[BigAddition portHumanColor] range:drumTask];
            [musicAdjusts addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:drumTask];
            
            self.cardSmartLabel.attributedText = musicAdjusts;
        }
        
        [self.twoMainMapLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.middlePoloView.mas_right).offset(BigAddition.noiseFactMen.lossArranged);
            make.top.equalTo(self.middlePoloView).offset(BigAddition.noiseFactMen.lawPhotoTry);
        }];
    }
}

@end
