import 'feedback.dart';
import 'user.dart';

class Reply {
  int id;
  int status;
  final String text;
  final String createdAt;
  final bool liked;
  final bool disliked;
  final FeedbackData feedback;
  final UserOverview user;
  final UserOverview toUser;
  final String? mention;

  Reply({
    required this.id,
    required this.text,
    required this.createdAt,
    required this.liked,
    required this.disliked,
    required this.feedback,
    required this.user,
    required this.toUser,
    required this.status,
     this.mention,
  });

  factory Reply.fromJson(Map<String, dynamic> json) => Reply(
        id: json['id'],
        text: json['text'],
        createdAt: json['createdAt'],
        liked: json['liked'],
        disliked: json['disliked'],
        feedback: FeedbackData.fromJson(json['feedback']),
        user: UserOverview.fromJson(json['user']),
        toUser: UserOverview.fromJson(json['toUser']),
        status: json['status'],
    mention: json['mention'],
      );

  Map<String, dynamic> toJson() => {
        'id': id,
        'text': text,
        'createdAt': createdAt,
        'liked': liked,
        'disliked': disliked,
        'feedback': feedback.toJson(),
        'user': user.toJson(),
        'toUser': toUser.toJson(),
        'mention': mention,
      };
}
