11namespace Codebreaker . ViewModels . Models ;
22
33public partial class Game (
4- Guid gameId ,
4+ Guid id ,
55 GameType gameType ,
66 string playerName ,
77 DateTime startTime ,
88 int numberCodes ,
9- int maxMoves ) : ObservableObject
9+ int maxMoves ,
10+ IDictionary < string , string [ ] > fieldValues ) : ObservableObject
1011{
1112 /// <summary>
1213 /// Gets the unique identifier of the game.
1314 /// </summary>
14- public Guid GameId { get ; private set ; } = gameId ;
15+ public Guid Id { get ; private set ; } = id ;
1516
1617 /// <summary>
1718 /// Gets the type of the game. <see cref="GameType"/>
@@ -37,20 +38,15 @@ public partial class Game(
3738 /// Gets the end time of the game or null if it did not end yet. This value is set from a game guess anylzer after the game was ended.
3839 /// </summary>
3940 [ ObservableProperty ]
40- private string ? _endTime ;
41+ [ NotifyPropertyChangedFor ( nameof ( IsFinished ) ) ]
42+ private DateTime ? _endTime ;
4143
4244 /// <summary>
4345 /// Gets the duration of the game or null if it did not end yet
4446 /// </summary>
4547 [ ObservableProperty ]
4648 private TimeSpan ? _duration ;
4749
48- /// <summary>
49- /// Gets the last move number. This number is set from an game move analyer after the move was set.
50- /// </summary>
51- [ ObservableProperty ]
52- private int _lastMoveNumber ;
53-
5450 /// <summary>
5551 /// Gets the number of codes the player needs to fill.
5652 /// </summary>
@@ -61,6 +57,11 @@ public partial class Game(
6157 /// </summary>
6258 public int MaxMoves { get ; private set ; } = maxMoves ;
6359
60+ /// <summary>
61+ /// Gets a boolean value indicating if the game is finished.
62+ /// </summary>
63+ public bool IsFinished => EndTime is not null ;
64+
6465 /// <summary>
6566 /// Did the player win the game?
6667 /// </summary>
@@ -70,12 +71,10 @@ public partial class Game(
7071 /// <summary>
7172 /// A list of possible field values the user has to chose from
7273 /// </summary>
73- public required IDictionary < string , string [ ] > FieldValues { get ; init ; }
74+ public IDictionary < string , string [ ] > FieldValues { get ; init ; } = fieldValues ;
7475
7576 /// <summary>
7677 /// A list of moves the player made
7778 /// </summary>
78- public ICollection < Move > Moves { get ; } = new ObservableCollection < Move > ( ) ;
79-
80- public override string ToString ( ) => $ "{ GameId } :{ GameType } - { StartTime } ";
79+ public ObservableCollection < Move > Moves { get ; } = [ ] ;
8180}
0 commit comments