7
7
import 'package:flutter/material.dart' ;
8
8
import 'package:freezed_annotation/freezed_annotation.dart' ;
9
9
10
+ import '../../../common/constants/enums/generic_entity.dart' ;
10
11
import '../../../common/utils/converter/epoch_date_time_converter.dart' ;
11
12
import '../../../common/utils/extensions/custom_extensions.dart' ;
12
- import '../../../common/utils/json_abstract.dart' ;
13
13
import '../enums/box_status.dart' ;
14
14
15
15
part 'box.freezed.dart' ;
@@ -42,7 +42,7 @@ enum YearBoxFields {
42
42
}
43
43
44
44
sealed class Box {
45
- int get boxNumber ;
45
+ int get id ;
46
46
BoxStatus get boxStatus;
47
47
bool get hasLandMark;
48
48
String get chatGroupId;
@@ -51,10 +51,10 @@ sealed class Box {
51
51
}
52
52
53
53
@freezed
54
- class DayBox with _$DayBox implements JsonAbstract , Box {
54
+ class DayBox with _$DayBox implements GenericEntity < int > , Box {
55
55
const DayBox ._();
56
56
factory DayBox ({
57
- required int boxNumber ,
57
+ @JsonKey (name : 'boxNumber' ) required int id ,
58
58
@EpochDateTimeConverter () required DateTime date,
59
59
required BoxStatus boxStatus,
60
60
required int weekNumber,
@@ -70,14 +70,14 @@ class DayBox with _$DayBox implements JsonAbstract, Box {
70
70
71
71
/// For Chat group name
72
72
@override
73
- String get chatGroupId => "DAY_$boxNumber " ;
73
+ String get chatGroupId => "DAY_$id " ;
74
74
}
75
75
76
76
@freezed
77
- class WeekBox with _$WeekBox implements JsonAbstract , Box {
77
+ class WeekBox with _$WeekBox implements GenericEntity < int > , Box {
78
78
const WeekBox ._();
79
79
factory WeekBox ({
80
- required int boxNumber ,
80
+ @JsonKey (name : 'boxNumber' ) required int id ,
81
81
@EpochDateTimeConverter () required DateTime startDate,
82
82
@EpochDateTimeConverter () required DateTime endDate,
83
83
required BoxStatus boxStatus,
@@ -93,15 +93,15 @@ class WeekBox with _$WeekBox implements JsonAbstract, Box {
93
93
94
94
/// For Chat group name
95
95
@override
96
- String get chatGroupId => "WEEK_$boxNumber " ;
96
+ String get chatGroupId => "WEEK_$id " ;
97
97
}
98
98
99
99
@freezed
100
- class YearBox with _$YearBox implements JsonAbstract , Box {
100
+ class YearBox with _$YearBox implements GenericEntity < int > , Box {
101
101
const YearBox ._();
102
102
103
103
factory YearBox ({
104
- required int boxNumber ,
104
+ @JsonKey (name : 'boxNumber' ) required int id ,
105
105
@EpochDateTimeConverter () required DateTime startDate,
106
106
@EpochDateTimeConverter () required DateTime endDate,
107
107
required BoxStatus boxStatus,
@@ -116,5 +116,5 @@ class YearBox with _$YearBox implements JsonAbstract, Box {
116
116
117
117
/// For Chat group name
118
118
@override
119
- String get chatGroupId => "YEAR_$boxNumber " ;
119
+ String get chatGroupId => "YEAR_$id " ;
120
120
}
0 commit comments