import 'package:flutter/foundation.dart';

@immutable
class NewsData {
  final int id;
  final String title;
  final String reference;
  final String description;
  final String createdAt;
  final String updatedAt;

  const NewsData({
    required this.id,
    required this.title,
    required this.reference,
    required this.description,
    required this.createdAt,
    required this.updatedAt,
  });

  factory NewsData.fromJson(Map<String, dynamic> json) => NewsData(
        id: json['id'],
        title: json['title'],
        reference: json['reference'],
        description: json['description'],
        createdAt: json['createdAt'],
        updatedAt: json['updatedAt'],
      );

  Map<String, dynamic> toJson() => {
        'id': id,
        'title': title,
        'reference': reference,
        'description': description,
        'createdAt': createdAt,
        'updatedAt': updatedAt,
      };
}
