Skip to content

Commit

Permalink
feat: update board section model
Browse files Browse the repository at this point in the history
  • Loading branch information
jsgalarraga committed Mar 4, 2024
1 parent 002816c commit b8d9088
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
24 changes: 13 additions & 11 deletions api/packages/game_domain/lib/src/models/board_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,37 @@ 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}
factory BoardSection.fromJson(Map<String, dynamic> json) =>
_$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.
@JsonKey()
@PointConverter()
final Point<int> 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<Word> 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<Word> words;
final List<Word> borderWords;

/// Returns a json representation from this instance.
Map<String, dynamic> toJson() => _$BoardSectionToJson(this);
Expand All @@ -51,8 +53,8 @@ class BoardSection extends Equatable {
List<Object?> get props => [
id,
position,
width,
height,
size,
words,
borderWords,
];
}
11 changes: 6 additions & 5 deletions api/packages/game_domain/lib/src/models/board_section.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b8d9088

Please sign in to comment.