using System; using System.Collections.Generic; namespace HN.Domain { public sealed class Link { public Guid Id { get; } public string Url { get; } public DateTime CreatedAt { get; } private List _votes; public IReadOnlyList Votes => _votes; private Link(string url) { this.Id = Guid.NewGuid(); this.CreatedAt = DateTime.UtcNow; this.Url = url; this._votes = new List(); } public static Link FromUrl(string url) { return new Link(url); } public void Upvote() { _votes.Add(new Vote(VoteType.Up)); } public void Downvote() { _votes.Add(new Vote(VoteType.Down)); } public Comment AddComment(string content) { return new Comment(Id, content); } } }