//
//  ERTCMemberNetworkScreenShareTitleCell.m
//  EZSaaSVideoConferenceSDK
//
//  Created by wangjinlong23 on 2022/7/4.
//  Copyright © 2022 EZSaaS. All rights reserved.
//

#import "ERTCMemberNetworkScreenShareTitleCell.h"

@interface ERTCMemberNetworkScreenShareTitleCell ()
@property (nonatomic, strong) UIStackView *stackView;
@end

@implementation ERTCMemberNetworkScreenShareTitleCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.contentView.backgroundColor = [UIColor clearColor];
        self.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:self.stackView];

        UILabel *label = [self getLabel];
        label.text = @"用户";
        [self.stackView addArrangedSubview:label];
        
        label = [self getLabel];
        label.text = @"传输码率";
        [self.stackView addArrangedSubview:label];
        
        label = [self getLabel];
        label.text = @"丢包率";
        [self.stackView addArrangedSubview:label];
        
        label = [self getLabel];
        label.text = @"总卡顿时长";
        [self.stackView addArrangedSubview:label];
        
        label = [self getLabel];
        label.text = @"卡顿比";
        [self.stackView addArrangedSubview:label];
        
        label = [self getLabel];
        label.text = @"总包数";
        [self.stackView addArrangedSubview:label];
        
        
        label = [self getLabel];
        label.text = @"补前丢包率";
        [self.stackView addArrangedSubview:label];
        
        label = [self getLabel];
        label.text = @"帧率大小";
        [self.stackView addArrangedSubview:label];
        
        label = [self getLabel];
        label.text = @"流类型";
        [self.stackView addArrangedSubview:label];
        
        label = [self getLabel];
        label.text = @"宽高";
        [self.stackView addArrangedSubview:label];
   
        [self.stackView ysmas_makeConstraints:^(YSMASConstraintMaker *make) {
            make.left.right.top.equalTo(self.contentView);
            make.bottom.equalTo(self.contentView).with.offset(-1);
        }];
    }
    
    return self;
}

-(UIStackView *)stackView {
    if (!_stackView) {
        _stackView = [[UIStackView alloc] init];
        _stackView.backgroundColor = [UIColor clearColor];
        _stackView.spacing = 1;
        _stackView.distribution = UIStackViewDistributionFillEqually;
        _stackView.layer.cornerRadius = 5;
    }
    
    return _stackView;
}

-(UILabel *)getLabel {
    UILabel *label = [[UILabel alloc] init];
    label.numberOfLines = 0;
    label.backgroundColor = [UIColor colorWithRed:131/255.f green:131/255.f blue:131/255.f alpha:0.55];//[UIColor whiteColor];
    label.textColor = [UIColor whiteColor];
    label.font = [UIFont systemFontOfSize:15];
    label.textAlignment = NSTextAlignmentCenter;
    return label;
}

+(CGFloat)heightForCell {
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, ([UIScreen mainScreen].bounds.size.width- 20)/9.f, 0)];
    label.text = @"延时自适应档位";
    label.font = [UIFont systemFontOfSize:15];;
    label.numberOfLines = 0;
    [label sizeToFit];
    CGFloat height = label.frame.size.height + 10;
    return ceil(height);
}

+(NSString *)cellReuseId {
    return @"ERTCMemberNetworkScreenShareTitleCell";
}

@end
