Code/Entities/Puzzle/PuzzleStorm/StormDay.cs

Data model for a PuzzleStorm day record. Holds properties like Id, Combo, Errors, Highest, Moves, Runs, Score and Time, and exposes a Date getter that parses the Id string in the format "year/month/day" into a DateTime.

🐞 Accessing Date on a default-constructed StormDay throws NullReferenceException because Id defaults to null and the getter calls Id.Split without a null check.
#nullable enable annotations

namespace LichessNET.Entities.Puzzle.PuzzleStorm;

public class StormDay
{
    public string Id { get; set; }

    public DateTime Date
    {
        get
        {
            return new DateTime(
                int.Parse(Id.Split('/')[0]),
                int.Parse(Id.Split('/')[1]),
                int.Parse(Id.Split('/')[2])
            );
        }
    }

    public int Combo { get; set; }
    public int Errors { get; set; }
    public int Highest { get; set; }
    public int Moves { get; set; }
    public int Runs { get; set; }
    public int Score { get; set; }
    public int Time { get; set; }
}