report.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import 'package:flutter/foundation.dart';
  2. enum ReportStatus { ok, warn, draft }
  3. @immutable
  4. final class Report {
  5. const Report({
  6. required this.id,
  7. required this.name,
  8. required this.project,
  9. required this.status,
  10. required this.date,
  11. this.reportId,
  12. this.fields,
  13. this.verdict,
  14. });
  15. final String id;
  16. final String name;
  17. final String project;
  18. final ReportStatus status;
  19. final DateTime date;
  20. final String? reportId;
  21. final List<ReportField>? fields;
  22. final String? verdict;
  23. Report copyWith({
  24. String? id,
  25. String? name,
  26. String? project,
  27. ReportStatus? status,
  28. DateTime? date,
  29. String? reportId,
  30. List<ReportField>? fields,
  31. String? verdict,
  32. }) {
  33. return Report(
  34. id: id ?? this.id,
  35. name: name ?? this.name,
  36. project: project ?? this.project,
  37. status: status ?? this.status,
  38. date: date ?? this.date,
  39. reportId: reportId ?? this.reportId,
  40. fields: fields ?? this.fields,
  41. verdict: verdict ?? this.verdict,
  42. );
  43. }
  44. }
  45. @immutable
  46. final class ReportField {
  47. const ReportField({required this.key, required this.value});
  48. final String key;
  49. final String value;
  50. }
  51. @immutable
  52. final class ReportDateGroup {
  53. const ReportDateGroup({required this.label, required this.reports});
  54. final String label;
  55. final List<Report> reports;
  56. }