//
//  LNIMChatSystemMessageCell.swift
//  Lanu
//
//  Created by OneeChan on 2025/12/5.
//

import Foundation
import UIKit
import SnapKit

class LNIMChatSystemMessageCell: UITableViewCell {
    private let contentLabel = UILabel()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        setupViews()
    }
    
    func update(_ data: LNIMMessageData) {
        contentLabel.text = data.content
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

extension LNIMChatSystemMessageCell {
    private func setupViews() {
        backgroundColor = .clear
        
        let container = UIView()
        container.backgroundColor = .fill
        container.layer.cornerRadius = 11
        contentView.addSubview(container)
        container.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(2)
            make.centerX.equalToSuperview()
            make.bottom.equalToSuperview().offset(-10)
        }
        
        contentLabel.font = .body_xs
        contentLabel.textColor = .text_3
        container.addSubview(contentLabel)
        contentLabel.snp.makeConstraints { make in
            make.verticalEdges.equalToSuperview().inset(4)
            make.horizontalEdges.equalToSuperview().inset(8)
        }
    }
}
