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

import Foundation
import UIKit
import SnapKit

class LNIMChatTextMessageCell: LNIMChatBaseMessageCell {
    private let contextLabel = UILabel()
    
    override func update(_ data: LNIMMessageData, viewModel: LNIMChatViewModel) {
        super.update(data, viewModel: viewModel)
        
        contextLabel.attributedText = data.textContent
    }
    
    override func setupViews() {
        super.setupViews()
        
        onLongPress { [weak self] in
            guard let self else { return }
            
            let pasteboard = UIPasteboard.general
            pasteboard.string = contextLabel.text
            showToast(.init(key: "A00159"))
        }
        
        contextLabel.font = .body_l
        contextLabel.textColor = .text_5
        contextLabel.numberOfLines = 0
        container.addSubview(contextLabel)
        contextLabel.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
    }
}

