






#import "BedCubeWidthCell.h"
#import "IndicesBest.h"
#import "Masonry.h"
#import "UIImage+SumImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+WorldHold.h"

@interface BedCubeWidthCell()


@property (nonatomic,strong) NSString * ageEndScaling;


@property (nonatomic,strong) UIImageView * sunMoveKitView;


@property (nonatomic,strong) UILabel * mustEldestLabel;


@property (nonatomic,strong) UILabel * manSocialLabel;

@property (nonatomic, strong) UIButton * photosButton;

@end

@implementation BedCubeWidthCell

- (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.sunMoveKitView = [UIImageView new];
        self.sunMoveKitView.tintColor = [IndicesBest sexExtrasColor];
        self.sunMoveKitView.layer.cornerRadius = IndicesBest.trustMainArm.modalHeapWon;
        [self.contentView addSubview:self.sunMoveKitView];
        [self.sunMoveKitView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(IndicesBest.trustMainArm.bodyThermal);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(IndicesBest.trustMainArm.gaussianRope);
        }];
        
        self.mustEldestLabel = [UILabel new];
        self.mustEldestLabel.font = [UIFont boldSystemFontOfSize:IndicesBest.trustMainArm.vowelCatChar];
        self.mustEldestLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.mustEldestLabel];
        
        self.manSocialLabel = [UILabel new];
        self.manSocialLabel.font = [UIFont boldSystemFontOfSize:IndicesBest.trustMainArm.areSixNormal];
        self.manSocialLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.manSocialLabel];
        
        [self.mustEldestLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.sunMoveKitView.mas_right).offset(IndicesBest.trustMainArm.sunKilohertz);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.manSocialLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mustEldestLabel);
            make.top.equalTo(self.mustEldestLabel.mas_bottom).offset(IndicesBest.trustMainArm.flatHelpTap);
        }];
        
        self.photosButton = [[UIButton alloc] init];
        _photosButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage busFactoredSockFlemishDeliveryName:IndicesBest.trustMainArm.complexFloorPlayAssetMap] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_photosButton setBackgroundImage:[UIImage busFactoredSockFlemishDeliveryName:IndicesBest.trustMainArm.lostDepthBackupAllArrow] forState: UIControlStateNormal];
        [_photosButton setBackgroundImage:image forState: UIControlStateSelected];
        _photosButton.tintColor = [IndicesBest sexExtrasColor];
        [self.contentView addSubview:_photosButton];
        [_photosButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-IndicesBest.trustMainArm.sunKilohertz);
            make.size.mas_equalTo(CGSizeMake(IndicesBest.trustMainArm.causeBoxFace, IndicesBest.trustMainArm.causeBoxFace));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _photosButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [IndicesBest sexExtrasColor].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 = IndicesBest.trustMainArm.bodyThermal;
    frame.size.width -= IndicesBest.trustMainArm.vowelCatChar;
    frame.origin.y += IndicesBest.trustMainArm.bodyThermal;
    frame.size.height -= IndicesBest.trustMainArm.bodyThermal;
    [super setFrame:frame];
    
    self.layer.cornerRadius = frame.size.height / 2.0;
}

-(void)setAgeEndScaling:(NSString *)ageEndScaling {
    _ageEndScaling = ageEndScaling;
    [self.sunMoveKitView sd_setImageWithURL:[NSURL URLWithString:ageEndScaling] placeholderImage:nil];
}

- (void)setStartLarge:(LawAboutCreditNumericToleranceLow *)startLarge {
    _startLarge= startLarge;
    self.ageEndScaling = startLarge.themeMeal;
    self.mustEldestLabel.text = startLarge.hisBecome;
    NSString *note = startLarge.millDense?:@"";
    if (note.receiveClang) {
        self.manSocialLabel.hidden = YES;
        [self.mustEldestLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.sunMoveKitView.mas_right).offset(IndicesBest.trustMainArm.sunKilohertz);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.manSocialLabel.hidden = NO;
        NSRange useCup = [note rangeOfString:IndicesBest.trustMainArm.gaspCustodianMaxOddTabShrink];
        NSRange revert = [note rangeOfString:IndicesBest.trustMainArm.tryHandballLazyTenBankersLiter];
        
        if (useCup.length == 0 && revert.length == 0) {
            self.manSocialLabel.text = note;
            self.manSocialLabel.font = [UIFont systemFontOfSize:IndicesBest.trustMainArm.areSixNormal];
            self.manSocialLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange winGroup = NSMakeRange(useCup.location+useCup.length, revert.location-(useCup.location+useCup.length));
            NSString *unwind = [note substringWithRange:winGroup];
            NSString *addMust = [note stringByReplacingOccurrencesOfString:IndicesBest.trustMainArm.gaspCustodianMaxOddTabShrink withString:@""];
            addMust = [addMust stringByReplacingOccurrencesOfString:IndicesBest.trustMainArm.tryHandballLazyTenBankersLiter withString:@""];
            
            winGroup = [addMust rangeOfString:unwind];
            NSMutableAttributedString *penCameraBag = [[NSMutableAttributedString alloc] initWithString:addMust];
            [penCameraBag addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, addMust.length)];
            [penCameraBag addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, addMust.length)];
            [penCameraBag addAttribute:NSForegroundColorAttributeName value:[IndicesBest sexExtrasColor] range:winGroup];
            [penCameraBag addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:winGroup];
            
            self.manSocialLabel.attributedText = penCameraBag;
        }
        
        [self.mustEldestLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.sunMoveKitView.mas_right).offset(IndicesBest.trustMainArm.sunKilohertz);
            make.top.equalTo(self.sunMoveKitView).offset(IndicesBest.trustMainArm.theDidFound);
        }];
    }
}

@end
