//
//  ChatQuoteView.m
//  AIIM
//
//  Created by qitewei on 2025/5/26.
//

#import "ChatQuoteView.h"

@implementation ChatQuoteView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self= [super initWithFrame:frame]) {
        self.backgroundColor = globalColor(GCTypeDark7);
        self.layer.cornerRadius = 5.f;
        self.layer.masksToBounds = YES;
        [self configUI];
    }
    return self;
}

- (void)configUI{
    [self addSubview:self.closeBtn];
    [self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(16, 16));
        make.centerY.mas_equalTo(self.mas_centerY);
        make.right.mas_equalTo(self.mas_right).offset(-8);
    }];
    
    [self addSubview:self.quoteContentLbl];
    [self.quoteContentLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(16);
        make.left.mas_equalTo(8);
        make.right.mas_equalTo(self.closeBtn.mas_left).offset(-8);
        make.centerY.mas_equalTo(self.mas_centerY);
    }];
}

- (void)setModel:(ChatMessageModel *)model{
    _model = model;
    self.quoteContentLbl.text = [NSString stringWithFormat:@"%@:%@",model.nickName,model.content];
    NSLog(@"1111111-------------");
}

- (UILabel *)quoteContentLbl{
    if (!_quoteContentLbl) {
        _quoteContentLbl = [UILabel new];
        _quoteContentLbl.textColor = globalColor(GCTypeDark3);
        _quoteContentLbl.font = SYSFONT(14);
    }
    return _quoteContentLbl;
}

- (UIButton *)closeBtn{
    if (!_closeBtn) {
        _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_closeBtn setBackgroundImage:kImageMake(@"quote_close") forState:UIControlStateNormal];
    }
    return _closeBtn;
}

@end
