//
//  ChatMsgDetailChatCell.m
//  smartRhino
//
//  Created by armin on 2019/11/7.
//  Copyright © 2019 tederen. All rights reserved.
//

#import "ChatMsgDetailChatCell.h"

@implementation ChatMsgDetailChatCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (CGFloat)configCell0Height{
    return 50;
}
+ (CGFloat)configCell1Height{
    return 47 + 15;
}
+ (CGFloat)configCell2HeightWithContent:(NSString *)content{
    CGFloat oneLineMaxW = SCREEN_WIDTH - (81+87);
    
    CGSize size = [content sizeWithFont:[UIFont systemFontOfSize:16] byWidth:oneLineMaxW textLineSpacing:5];
    
    if(size.height <= 40){
        return 40 + 15;
    }else{
        return size.height + 15 + 14*2;
    }
}
+ (CGFloat)configCell3HeightWithContent:(NSString *)content{
    CGFloat oneLineMaxW = SCREEN_WIDTH - (81+87);
    
    CGSize size = [content sizeWithFont:[UIFont systemFontOfSize:16] byWidth:oneLineMaxW textLineSpacing:5];
    
    if(size.height <= 40){
        return 40 + 15;
    }else{
        return size.height + 15 + 14*2;
    }
}

+ (ChatMsgDetailChatCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
    static NSString *cellIdentifer = @"ChatMsgDetailChatCell0";
    ChatMsgDetailChatCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgDetailChatCell" owner:nil options:nil] objectAtIndex:0];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = [UIColor clearColor];
    cell.contentView.backgroundColor = [UIColor clearColor];
    return cell;
}
+ (ChatMsgDetailChatCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
    static NSString *cellIdentifer = @"ChatMsgDetailChatCell1";
    ChatMsgDetailChatCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgDetailChatCell" owner:nil options:nil] objectAtIndex:1];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = [UIColor clearColor];
    cell.contentView.backgroundColor = [UIColor clearColor];
    cell.cell1ContentBgView.width = SCREEN_WIDTH - 66*2;
    [cell.cell1ContentBgView setRadius:5 corners:UIRectCornerAllCorners]; 
    return cell;
}
+ (ChatMsgDetailChatCell *)configCell2:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
    static NSString *cellIdentifer = @"ChatMsgDetailChatCell2";
    ChatMsgDetailChatCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgDetailChatCell" owner:nil options:nil] objectAtIndex:2];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = [UIColor clearColor];
    cell.contentView.backgroundColor = [UIColor clearColor];
    [cell.cell2LeftUserImg setRadius:2 corners:UIRectCornerAllCorners];
//    [cell.cell2LeftContentBgView setRadius:5 corners:UIRectCornerAllCorners];
    cell.cell2LeftContentBgView.layer.masksToBounds = YES;
    cell.cell2LeftContentBgView.layer.cornerRadius = 5;
     
    return cell;
}
+ (ChatMsgDetailChatCell *)configCell3:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
    static NSString *cellIdentifer = @"ChatMsgDetailChatCell3";
    ChatMsgDetailChatCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgDetailChatCell" owner:nil options:nil] objectAtIndex:3];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = [UIColor clearColor];
    cell.contentView.backgroundColor = [UIColor clearColor];
    [cell.cell3RightUserImg setRadius:2 corners:UIRectCornerAllCorners];
//    [cell.cell3RightContentBgView setRadius:5 corners:UIRectCornerAllCorners];
    cell.cell3RightContentBgView.layer.masksToBounds = YES;
    cell.cell3RightContentBgView.layer.cornerRadius = 5;
     
    return cell;
}
@end