import 'package:json_annotation/json_annotation.dart';

part 'service_comment.g.dart';

@JsonSerializable(explicitToJson: true)
class ServiceComment implements Comparable<ServiceComment> {
  final DateTime date;
  final String message;

  ServiceComment({required this.date, required this.message});

  factory ServiceComment.fromJson(Map<String, dynamic> json) =>
      _$ServiceCommentFromJson(json);

  Map<String, dynamic> toJson() => _$ServiceCommentToJson(this);

  @override
  int compareTo(ServiceComment other) {
    return -date.compareTo(other.date);
  }
}
