






#import "IllSinkAwakeCell.h"
#import "RowGivenOut.h"
#import "Masonry.h"
#import "UIImage+TopImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+Magnesium.h"

@interface IllSinkAwakeCell()


@property (nonatomic,strong) NSString * caseAnimating;


@property (nonatomic,strong) UIImageView * gaspLinearView;


@property (nonatomic,strong) UILabel * napUndoWasLabel;


@property (nonatomic,strong) UILabel * subsetBigLabel;

@property (nonatomic, strong) UIButton * useForButton;

@end

@implementation IllSinkAwakeCell

- (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.gaspLinearView = [UIImageView new];
        self.gaspLinearView.tintColor = [RowGivenOut drainBackColor];
        self.gaspLinearView.layer.cornerRadius = RowGivenOut.mathProxyKin.audibleTotal;
        [self.contentView addSubview:self.gaspLinearView];
        [self.gaspLinearView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(RowGivenOut.mathProxyKin.theSumThick);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(RowGivenOut.mathProxyKin.zoneVersions);
        }];
        
        self.napUndoWasLabel = [UILabel new];
        self.napUndoWasLabel.font = [UIFont boldSystemFontOfSize:RowGivenOut.mathProxyKin.funSlopePost];
        self.napUndoWasLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.napUndoWasLabel];
        
        self.subsetBigLabel = [UILabel new];
        self.subsetBigLabel.font = [UIFont boldSystemFontOfSize:RowGivenOut.mathProxyKin.legalHellman];
        self.subsetBigLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.subsetBigLabel];
        
        [self.napUndoWasLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.gaspLinearView.mas_right).offset(RowGivenOut.mathProxyKin.climbingMode);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.subsetBigLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.napUndoWasLabel);
            make.top.equalTo(self.napUndoWasLabel.mas_bottom).offset(RowGivenOut.mathProxyKin.cloudGolden);
        }];
        
        self.useForButton = [[UIButton alloc] init];
        _useForButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage guideTabTruncatedDoneMeterName:RowGivenOut.mathProxyKin.dispenseInsertedCompactCascadeFilenames] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_useForButton setBackgroundImage:[UIImage guideTabTruncatedDoneMeterName:RowGivenOut.mathProxyKin.combineEngineerPhraseBuilderForce] forState: UIControlStateNormal];
        [_useForButton setBackgroundImage:image forState: UIControlStateSelected];
        _useForButton.tintColor = [RowGivenOut drainBackColor];
        [self.contentView addSubview:_useForButton];
        [_useForButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-RowGivenOut.mathProxyKin.climbingMode);
            make.size.mas_equalTo(CGSizeMake(RowGivenOut.mathProxyKin.processesDog, RowGivenOut.mathProxyKin.processesDog));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _useForButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [RowGivenOut drainBackColor].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 = RowGivenOut.mathProxyKin.theSumThick;
    frame.size.width -= RowGivenOut.mathProxyKin.funSlopePost;
    frame.origin.y += RowGivenOut.mathProxyKin.theSumThick;
    frame.size.height -= RowGivenOut.mathProxyKin.theSumThick;
    [super setFrame:frame];
    
    self.layer.cornerRadius = frame.size.height / 2.0;
}

-(void)setCaseAnimating:(NSString *)caseAnimating {
    _caseAnimating = caseAnimating;
    [self.gaspLinearView sd_setImageWithURL:[NSURL URLWithString:caseAnimating] placeholderImage:nil];
}

- (void)setNumericHue:(FaxClosureWrestlingReminderProcedureReal *)numericHue {
    _numericHue= numericHue;
    self.caseAnimating = numericHue.reloadLaw;
    self.napUndoWasLabel.text = numericHue.hairBelow;
    NSString *note = numericHue.scheduled?:@"";
    if (note.hindiDecimal) {
        self.subsetBigLabel.hidden = YES;
        [self.napUndoWasLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.gaspLinearView.mas_right).offset(RowGivenOut.mathProxyKin.climbingMode);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.subsetBigLabel.hidden = NO;
        NSRange eggPut = [note rangeOfString:RowGivenOut.mathProxyKin.positionRectumSheRawWaxCard];
        NSRange didNap = [note rangeOfString:RowGivenOut.mathProxyKin.requireUnderageEligibleLiteralProcessedKelvin];
        
        if (eggPut.length == 0 && didNap.length == 0) {
            self.subsetBigLabel.text = note;
            self.subsetBigLabel.font = [UIFont systemFontOfSize:RowGivenOut.mathProxyKin.legalHellman];
            self.subsetBigLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange cycleKin = NSMakeRange(eggPut.location+eggPut.length, didNap.location-(eggPut.location+eggPut.length));
            NSString *dayAdd = [note substringWithRange:cycleKin];
            NSString *archive = [note stringByReplacingOccurrencesOfString:RowGivenOut.mathProxyKin.positionRectumSheRawWaxCard withString:@""];
            archive = [archive stringByReplacingOccurrencesOfString:RowGivenOut.mathProxyKin.requireUnderageEligibleLiteralProcessedKelvin withString:@""];
            
            cycleKin = [archive rangeOfString:dayAdd];
            NSMutableAttributedString *focusApplies = [[NSMutableAttributedString alloc] initWithString:archive];
            [focusApplies addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, archive.length)];
            [focusApplies addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, archive.length)];
            [focusApplies addAttribute:NSForegroundColorAttributeName value:[RowGivenOut drainBackColor] range:cycleKin];
            [focusApplies addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:cycleKin];
            
            self.subsetBigLabel.attributedText = focusApplies;
        }
        
        [self.napUndoWasLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.gaspLinearView.mas_right).offset(RowGivenOut.mathProxyKin.climbingMode);
            make.top.equalTo(self.gaspLinearView).offset(RowGivenOut.mathProxyKin.catInterPen);
        }];
    }
}

@end
