diff --git a/api/packages/game_domain/lib/src/models/board_section.dart b/api/packages/game_domain/lib/src/models/board_section.dart index 2580fcf1d..fba74ca0c 100644 --- a/api/packages/game_domain/lib/src/models/board_section.dart +++ b/api/packages/game_domain/lib/src/models/board_section.dart @@ -14,9 +14,9 @@ class BoardSection extends Equatable { const BoardSection({ required this.id, required this.position, - required this.width, - required this.height, + required this.size, required this.words, + required this.borderWords, }); /// {@macro board_section} @@ -24,7 +24,9 @@ class BoardSection extends Equatable { _$BoardSectionFromJson(json); /// Unique identifier of board section. - @JsonKey() + /// + /// Intentionally left out of serialization to avoid redundancy. + @JsonKey(includeToJson: false) final String id; /// Position of the board section in the board. The origin is the top left. @@ -32,17 +34,17 @@ class BoardSection extends Equatable { @PointConverter() final Point position; - /// Width of the board section. + /// Size of the squared board section. @JsonKey() - final int width; + final int size; - /// Height of the board section. + /// The words that start in this board section. @JsonKey() - final int height; + final List words; - /// The words that are contained in this board section. + /// The words that end in this board section, but don't start in it. @JsonKey() - final List words; + final List borderWords; /// Returns a json representation from this instance. Map toJson() => _$BoardSectionToJson(this); @@ -51,8 +53,8 @@ class BoardSection extends Equatable { List get props => [ id, position, - width, - height, + size, words, + borderWords, ]; } diff --git a/api/packages/game_domain/lib/src/models/board_section.g.dart b/api/packages/game_domain/lib/src/models/board_section.g.dart index 6852544d9..a1730b2d6 100644 --- a/api/packages/game_domain/lib/src/models/board_section.g.dart +++ b/api/packages/game_domain/lib/src/models/board_section.g.dart @@ -10,18 +10,19 @@ BoardSection _$BoardSectionFromJson(Map json) => BoardSection( id: json['id'] as String, position: const PointConverter() .fromJson(json['position'] as Map), - width: json['width'] as int, - height: json['height'] as int, + size: json['size'] as int, words: (json['words'] as List) .map((e) => Word.fromJson(e as Map)) .toList(), + borderWords: (json['borderWords'] as List) + .map((e) => Word.fromJson(e as Map)) + .toList(), ); Map _$BoardSectionToJson(BoardSection instance) => { - 'id': instance.id, 'position': const PointConverter().toJson(instance.position), - 'width': instance.width, - 'height': instance.height, + 'size': instance.size, 'words': instance.words.map((e) => e.toJson()).toList(), + 'borderWords': instance.borderWords.map((e) => e.toJson()).toList(), };