import 'package:taafee_mobile/features/auth/data_layer/model/user.dart';

class FeedbackModel {
  int id;
  int stars;
  String feedback;
  User user;
  int cardId;

  FeedbackModel({
    required this.id,
    required this.stars,
    required this.feedback,
    required this.user,
    required this.cardId,
  });

  factory FeedbackModel.fromJson(Map<String, dynamic> json) => FeedbackModel(
        id: json["id"],
        stars: json["stars"],
        feedback: json["feedback"].toString(),
        user: User.fromJson(json["user"]),
        cardId: json["card_id"],
      );

  static List<FeedbackModel> fromJsonList(Map<String, dynamic> json) {
    List<FeedbackModel> feedback = [];
    json["data"].forEach(
      (element) => feedback.add(
        FeedbackModel.fromJson(element),
      ),
    );
    return feedback;
  }
}
