






#import "DraftRematchCell.h"
#import "WetDoneFill.h"
#import "Masonry.h"
#import "UIImage+TryImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+Enclosing.h"

@interface DraftRematchCell()


@property (nonatomic,strong) NSString * affectedThree;


@property (nonatomic,strong) UIImageView * tapPanLastView;


@property (nonatomic,strong) UILabel * passArabicLabel;


@property (nonatomic,strong) UILabel * balticOddLabel;

@property (nonatomic, strong) UIButton * wasAllButton;

@end

@implementation DraftRematchCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = WetDoneFill.artSensitive.yetThirdMax;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.tapPanLastView = [UIImageView new];
        self.tapPanLastView.tintColor = [WetDoneFill scrollHasColor];
        self.tapPanLastView.layer.cornerRadius = WetDoneFill.artSensitive.bagVitalFile;
        [self.contentView addSubview:self.tapPanLastView];
        [self.tapPanLastView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(WetDoneFill.artSensitive.nativeFetch);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(WetDoneFill.artSensitive.petiteExpert);
        }];
        
        self.passArabicLabel = [UILabel new];
        self.passArabicLabel.font = [UIFont boldSystemFontOfSize:WetDoneFill.artSensitive.lastExtraYet];
        self.passArabicLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.passArabicLabel];
        
        self.balticOddLabel = [UILabel new];
        self.balticOddLabel.font = [UIFont boldSystemFontOfSize:WetDoneFill.artSensitive.blurConsumer];
        self.balticOddLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.balticOddLabel];
        
        [self.passArabicLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.tapPanLastView.mas_right).offset(WetDoneFill.artSensitive.dueLawInside);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.balticOddLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.passArabicLabel);
            make.top.equalTo(self.passArabicLabel.mas_bottom).offset(WetDoneFill.artSensitive.twistGender);
        }];
        
        self.wasAllButton = [[UIButton alloc] init];
        _wasAllButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage regionsScriptClearEarEllipseName:WetDoneFill.artSensitive.obtainWeekendGreatRequestMight] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_wasAllButton setBackgroundImage:[UIImage regionsScriptClearEarEllipseName:WetDoneFill.artSensitive.widthIntegersSessionAllowTip] forState: UIControlStateNormal];
        [_wasAllButton setBackgroundImage:image forState: UIControlStateSelected];
        _wasAllButton.tintColor = [WetDoneFill scrollHasColor];
        [self.contentView addSubview:_wasAllButton];
        [_wasAllButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-WetDoneFill.artSensitive.dueLawInside);
            make.size.mas_equalTo(CGSizeMake(WetDoneFill.artSensitive.touchAgeRest, WetDoneFill.artSensitive.touchAgeRest));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _wasAllButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [WetDoneFill scrollHasColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = WetDoneFill.artSensitive.nativeFetch;
    frame.size.width -= WetDoneFill.artSensitive.lastExtraYet;
    frame.origin.y += WetDoneFill.artSensitive.nativeFetch;
    frame.size.height -= WetDoneFill.artSensitive.nativeFetch;
    [super setFrame:frame];
}

-(void)setAffectedThree:(NSString *)affectedThree {
    _affectedThree = affectedThree;
    [self.tapPanLastView sd_setImageWithURL:[NSURL URLWithString:affectedThree] placeholderImage:nil];
}

- (void)setOurUseSent:(StayAlbanianEasyHandlerSubmitTerminate *)ourUseSent {
    _ourUseSent= ourUseSent;
    self.affectedThree = ourUseSent.somaliSun;
    self.passArabicLabel.text = ourUseSent.modelBond;
    NSString *note = ourUseSent.converted?:@"";
    if (note.tipSlabLater) {
        self.balticOddLabel.hidden = YES;
        [self.passArabicLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.tapPanLastView.mas_right).offset(WetDoneFill.artSensitive.dueLawInside);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.balticOddLabel.hidden = NO;
        NSRange sunIll = [note rangeOfString:WetDoneFill.artSensitive.strengthIncrementSupplyEraWaxDry];
        NSRange artery = [note rangeOfString:WetDoneFill.artSensitive.yetMetalDisorderPastTodayLooper];
        
        if (sunIll.length == 0 && artery.length == 0) {
            self.balticOddLabel.text = note;
            self.balticOddLabel.font = [UIFont systemFontOfSize:WetDoneFill.artSensitive.blurConsumer];
            self.balticOddLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange tempBusy = NSMakeRange(sunIll.location+sunIll.length, artery.location-(sunIll.location+sunIll.length));
            NSString *cutAsk = [note substringWithRange:tempBusy];
            NSString *stopTry = [note stringByReplacingOccurrencesOfString:WetDoneFill.artSensitive.strengthIncrementSupplyEraWaxDry withString:@""];
            stopTry = [stopTry stringByReplacingOccurrencesOfString:WetDoneFill.artSensitive.yetMetalDisorderPastTodayLooper withString:@""];
            
            tempBusy = [stopTry rangeOfString:cutAsk];
            NSMutableAttributedString *streamAskBag = [[NSMutableAttributedString alloc] initWithString:stopTry];
            [streamAskBag addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, stopTry.length)];
            [streamAskBag addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, stopTry.length)];
            [streamAskBag addAttribute:NSForegroundColorAttributeName value:[WetDoneFill scrollHasColor] range:tempBusy];
            [streamAskBag addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:tempBusy];
            
            self.balticOddLabel.attributedText = streamAskBag;
        }
        
        [self.passArabicLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.tapPanLastView.mas_right).offset(WetDoneFill.artSensitive.dueLawInside);
            make.top.equalTo(self.tapPanLastView).offset(WetDoneFill.artSensitive.kilogramTry);
        }];
    }
}

@end
