namespace Journal.Core.Models; public class TodoItem { public Guid Id { get; } public Guid ListId { get; } public string Text { get; set; } public bool Done { get; set; } public int SortOrder { get; set; } public TodoItem(Guid listId, string text, int sortOrder = 0) { Validate(text); if (listId == Guid.Empty) throw new ArgumentException("ListId is required", nameof(listId)); Id = Guid.NewGuid(); ListId = listId; Text = text.Trim(); Done = false; SortOrder = sortOrder; } public TodoItem(Guid id, Guid listId, string text, bool done, int sortOrder) { if (id == Guid.Empty) throw new ArgumentException("Id is required", nameof(id)); if (listId == Guid.Empty) throw new ArgumentException("ListId is required", nameof(listId)); Validate(text); Id = id; ListId = listId; Text = text.Trim(); Done = done; SortOrder = sortOrder; } private static void Validate(string text) { if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("Text is required", nameof(text)); } }