using System; using System.Collections.Generic; namespace HN.Domain { public sealed class Comment { public Guid Id { get; private set; } public Guid LinkId { get; private set; } public string Content { get; private set; } public DateTime CreatedAt { get; private set; } private List _votes; public IReadOnlyList Votes => _votes; internal Comment(Guid linkId, string content) { Id = Guid.NewGuid(); LinkId = linkId; Content = content; CreatedAt = DateTime.UtcNow; _votes = new List(); } public void Upvote() { _votes.Add(new Vote(VoteType.Up)); } public void Downvote() { _votes.Add(new Vote(VoteType.Down)); } } }