class Vehicle { final String id; final String make; final String model; final String color; final String licensePlate; final DateTime updatedAt; Vehicle({ required this.id, required this.make, required this.model, required this.color, required this.licensePlate, required this.updatedAt, }); String get displayName => '$color $make $model ($licensePlate)'; Vehicle copyWith({ String? make, String? model, String? color, String? licensePlate, DateTime? updatedAt, }) { return Vehicle( id: id, make: make ?? this.make, model: model ?? this.model, color: color ?? this.color, licensePlate: licensePlate ?? this.licensePlate, updatedAt: updatedAt ?? this.updatedAt, ); } Map toJson() => { 'id': id, 'make': make, 'model': model, 'color': color, 'licensePlate': licensePlate, 'updatedAt': updatedAt.toIso8601String(), }; factory Vehicle.fromJson(Map json) => Vehicle( id: json['id'] as String, make: json['make'] as String, model: json['model'] as String, color: json['color'] as String, licensePlate: json['licensePlate'] as String, updatedAt: json['updatedAt'] != null ? DateTime.parse(json['updatedAt'] as String) : DateTime.fromMillisecondsSinceEpoch(0), ); }