import 'package:intl/intl.dart';

class ReviewModel {
  late int id;
  late String title;
  late String rating;
  late String comment;
  late String name;
  late String createdAt;

  ReviewModel({
    required this.id,
    required this.title,
    required this.rating,
    required this.comment,
    required this.name,
    required this.createdAt,
  });

  ReviewModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    title = json['title'];
    rating = json['rating'];
    comment = json['comment'];
    name = json['name'];
    createdAt = DateFormat('dd-MM-yyyy, HH:mm').format(DateTime.parse(json['created_at'])); //json['created_at'];
  }

  static List<ReviewModel> listFromJson(list) => List<ReviewModel>.from(list.map((x) => ReviewModel.fromJson(x)));
}
