class ChatMessage { final String text; final bool isUser; final DateTime timestamp; final int? emotionCategory; // ← 새로 추가 (봇 메시지의 감정) ChatMessage({ required this.text, required this.isUser, required this.timestamp, this.emotionCategory, }); // JSON에서 ChatMessage로 변환 factory ChatMessage.fromJson(Map json) { return ChatMessage( text: json['text'] as String, isUser: json['isUser'] as bool, timestamp: DateTime.parse(json['timestamp'] as String), emotionCategory: json['emotionCategory'] as int?, ); } // ChatMessage를 JSON으로 변환 Map toJson() { return { 'text': text, 'isUser': isUser, 'timestamp': timestamp.toIso8601String(), 'emotionCategory': emotionCategory, }; } }