diff --git a/lib/src/entities/worldstate/steel_path.dart b/lib/src/entities/worldstate/steel_path.dart index f793d15..aa362e8 100644 --- a/lib/src/entities/worldstate/steel_path.dart +++ b/lib/src/entities/worldstate/steel_path.dart @@ -8,10 +8,14 @@ class SteelPath extends WorldstateObject { required DateTime expiry, required this.currentReward, required this.rotation, + required this.evergreens, + required this.incursions, }) : super(activation: activation, expiry: expiry); final SteelPathReward currentReward; final List rotation; + final List evergreens; + final Incursions incursions; @override List get props => super.props..addAll([currentReward, rotation]); @@ -26,3 +30,11 @@ class SteelPathReward extends Equatable { @override List get props => [name, cost]; } + +class Incursions extends WorldstateObject { + const Incursions({ + required super.id, + required super.activation, + required super.expiry, + }); +} diff --git a/lib/src/models/worldstate/steel_path_model.dart b/lib/src/models/worldstate/steel_path_model.dart index cf29160..14cb50a 100644 --- a/lib/src/models/worldstate/steel_path_model.dart +++ b/lib/src/models/worldstate/steel_path_model.dart @@ -11,9 +11,13 @@ class SteelPathModel extends SteelPath { required super.expiry, required this.currentReward, required this.rotation, + required this.evergreens, + required this.incursions, }) : super( currentReward: currentReward, rotation: rotation, + evergreens: evergreens, + incursions: incursions, ); factory SteelPathModel.fromJson(Map json) { @@ -26,6 +30,12 @@ class SteelPathModel extends SteelPath { @override final List rotation; + @override + final List evergreens; + + @override + final IncursionsModel incursions; + Map toJson() => _$SteelPathModelToJson(this); } @@ -39,3 +49,18 @@ class SteelPathRewardModel extends SteelPathReward { Map toJson() => _$SteelPathRewardModelToJson(this); } + +@JsonSerializable() +class IncursionsModel extends Incursions { + const IncursionsModel({ + required super.id, + required super.activation, + required super.expiry, + }); + + factory IncursionsModel.fromJson(Map json) { + return _$IncursionsModelFromJson(json); + } + + Map toJson() => _$IncursionsModelToJson(this); +} diff --git a/lib/src/models/worldstate/steel_path_model.g.dart b/lib/src/models/worldstate/steel_path_model.g.dart index 70b919c..578eeb5 100644 --- a/lib/src/models/worldstate/steel_path_model.g.dart +++ b/lib/src/models/worldstate/steel_path_model.g.dart @@ -24,6 +24,14 @@ SteelPathModel _$SteelPathModelFromJson(Map json) => $checkedCreate( .map((e) => SteelPathRewardModel.fromJson( Map.from(e as Map))) .toList()), + evergreens: $checkedConvert( + 'evergreens', + (v) => (v as List) + .map((e) => SteelPathRewardModel.fromJson( + Map.from(e as Map))) + .toList()), + incursions: $checkedConvert( + 'incursions', (v) => IncursionsModel.fromJson(v as Map)), ); return val; }, @@ -35,6 +43,8 @@ Map _$SteelPathModelToJson(SteelPathModel instance) => 'expiry': instance.expiry?.toIso8601String(), 'currentReward': instance.currentReward.toJson(), 'rotation': instance.rotation.map((e) => e.toJson()).toList(), + 'evergreens': instance.evergreens.map((e) => e.toJson()).toList(), + 'incursions': instance.incursions.toJson(), }; SteelPathRewardModel _$SteelPathRewardModelFromJson(Map json) => $checkedCreate( @@ -55,3 +65,25 @@ Map _$SteelPathRewardModelToJson( 'name': instance.name, 'cost': instance.cost, }; + +IncursionsModel _$IncursionsModelFromJson(Map json) => $checkedCreate( + 'IncursionsModel', + json, + ($checkedConvert) { + final val = IncursionsModel( + id: $checkedConvert('id', (v) => v as String?), + activation: $checkedConvert('activation', + (v) => v == null ? null : DateTime.parse(v as String)), + expiry: $checkedConvert( + 'expiry', (v) => v == null ? null : DateTime.parse(v as String)), + ); + return val; + }, + ); + +Map _$IncursionsModelToJson(IncursionsModel instance) => + { + 'id': instance.id, + 'activation': instance.activation?.toIso8601String(), + 'expiry': instance.expiry?.toIso8601String(), + };