






#import "WrappersExecCell.h"
#import "DistantEach.h"
#import "Masonry.h"
#import "UIImage+SunImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+Redirects.h"

@interface WrappersExecCell()


@property (nonatomic,strong) NSString * topSinkCarCar;


@property (nonatomic,strong) UIImageView * bigNeedOptView;


@property (nonatomic,strong) UILabel * getMarathiLabel;


@property (nonatomic,strong) UILabel * protocolsLabel;

@property (nonatomic, strong) UIButton * cutDogButton;

@end

@implementation WrappersExecCell

- (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.bigNeedOptView = [UIImageView new];
        self.bigNeedOptView.tintColor = [DistantEach tildePastColor];
        self.bigNeedOptView.layer.cornerRadius = DistantEach.whoFrenchMin.eggGathering;
        [self.contentView addSubview:self.bigNeedOptView];
        [self.bigNeedOptView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(DistantEach.whoFrenchMin.scoreTriple);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(DistantEach.whoFrenchMin.adjustAssert);
        }];
        
        self.getMarathiLabel = [UILabel new];
        self.getMarathiLabel.font = [UIFont boldSystemFontOfSize:DistantEach.whoFrenchMin.pinkBrowsing];
        self.getMarathiLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.getMarathiLabel];
        
        self.protocolsLabel = [UILabel new];
        self.protocolsLabel.font = [UIFont boldSystemFontOfSize:DistantEach.whoFrenchMin.jobMapReason];
        self.protocolsLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.protocolsLabel];
        
        [self.getMarathiLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.bigNeedOptView.mas_right).offset(DistantEach.whoFrenchMin.loopsTypeRet);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.protocolsLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.getMarathiLabel);
            make.top.equalTo(self.getMarathiLabel.mas_bottom).offset(DistantEach.whoFrenchMin.burnTryCert);
        }];
        
        self.cutDogButton = [[UIButton alloc] init];
        _cutDogButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage exerciseSoundDescribeSunAnchoredName:DistantEach.whoFrenchMin.speedBigWasBlinkCapture] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_cutDogButton setBackgroundImage:[UIImage exerciseSoundDescribeSunAnchoredName:DistantEach.whoFrenchMin.serverTrapDingbatsExclusivePolar] forState: UIControlStateNormal];
        [_cutDogButton setBackgroundImage:image forState: UIControlStateSelected];
        _cutDogButton.tintColor = [DistantEach tildePastColor];
        [self.contentView addSubview:_cutDogButton];
        [_cutDogButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-DistantEach.whoFrenchMin.loopsTypeRet);
            make.size.mas_equalTo(CGSizeMake(DistantEach.whoFrenchMin.velocityChar, DistantEach.whoFrenchMin.velocityChar));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _cutDogButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [DistantEach tildePastColor].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 = DistantEach.whoFrenchMin.scoreTriple;
    frame.size.width -= DistantEach.whoFrenchMin.pinkBrowsing;
    frame.origin.y += DistantEach.whoFrenchMin.scoreTriple;
    frame.size.height -= DistantEach.whoFrenchMin.scoreTriple;
    [super setFrame:frame];
    
    self.layer.cornerRadius = frame.size.height / 2.0;
}

-(void)setTopSinkCarCar:(NSString *)topSinkCarCar {
    _topSinkCarCar = topSinkCarCar;
    [self.bigNeedOptView sd_setImageWithURL:[NSURL URLWithString:topSinkCarCar] placeholderImage:nil];
}

- (void)setLogLawRate:(FitnessHyphenUnboundSemicolonSettingSun *)logLawRate {
    _logLawRate= logLawRate;
    self.topSinkCarCar = logLawRate.bezelFunk;
    self.getMarathiLabel.text = logLawRate.bagAssume;
    NSString *note = logLawRate.redDarwin?:@"";
    if (note.penBiotinIts) {
        self.protocolsLabel.hidden = YES;
        [self.getMarathiLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.bigNeedOptView.mas_right).offset(DistantEach.whoFrenchMin.loopsTypeRet);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.protocolsLabel.hidden = NO;
        NSRange darwin = [note rangeOfString:DistantEach.whoFrenchMin.saveEllipsisExportBitmapIncrementBit];
        NSRange fatMan = [note rangeOfString:DistantEach.whoFrenchMin.irregularEndInterlaceExpertSubmitRelay];
        
        if (darwin.length == 0 && fatMan.length == 0) {
            self.protocolsLabel.text = note;
            self.protocolsLabel.font = [UIFont systemFontOfSize:DistantEach.whoFrenchMin.jobMapReason];
            self.protocolsLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange eligible = NSMakeRange(darwin.location+darwin.length, fatMan.location-(darwin.location+darwin.length));
            NSString *putEra = [note substringWithRange:eligible];
            NSString *lastOur = [note stringByReplacingOccurrencesOfString:DistantEach.whoFrenchMin.saveEllipsisExportBitmapIncrementBit withString:@""];
            lastOur = [lastOur stringByReplacingOccurrencesOfString:DistantEach.whoFrenchMin.irregularEndInterlaceExpertSubmitRelay withString:@""];
            
            eligible = [lastOur rangeOfString:putEra];
            NSMutableAttributedString *invertBridge = [[NSMutableAttributedString alloc] initWithString:lastOur];
            [invertBridge addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, lastOur.length)];
            [invertBridge addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, lastOur.length)];
            [invertBridge addAttribute:NSForegroundColorAttributeName value:[DistantEach tildePastColor] range:eligible];
            [invertBridge addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:eligible];
            
            self.protocolsLabel.attributedText = invertBridge;
        }
        
        [self.getMarathiLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.bigNeedOptView.mas_right).offset(DistantEach.whoFrenchMin.loopsTypeRet);
            make.top.equalTo(self.bigNeedOptView).offset(DistantEach.whoFrenchMin.endLeaseHit);
        }];
    }
}

@end
