namespace Domain.Entities.Common; public class NavMenuItem { public int ID { get; private set; } public string Label { get; private set; } = default!; public string Href { get; private set; } = default!; public int SortOrder { get; private set; } = 0; public bool IsVisible { get; private set; } = true; public DateTime UpdatedAt { get; private set; } = DateTime.UtcNow; public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; private NavMenuItem() { } private NavMenuItem(string label, string href, int sortOrder, bool isVisible) { if (string.IsNullOrWhiteSpace(label)) { throw new ArgumentException("Label is required.", nameof(label)); } if (label.Length > 50) { throw new ArgumentOutOfRangeException(nameof(label)); } if (string.IsNullOrWhiteSpace(href)) { throw new ArgumentException("Href is required.", nameof(href)); } if (href.Length > 200) { throw new ArgumentOutOfRangeException(nameof(href)); } Label = label; Href = href; SortOrder = sortOrder; IsVisible = isVisible; } public static NavMenuItem Create(string label, string href, int sortOrder, bool isVisible) { return new(label, href, sortOrder, isVisible); } public void Update(string label, string href, int sortOrder, bool isVisible) { if (string.IsNullOrWhiteSpace(label)) { throw new ArgumentException("Label is required.", nameof(label)); } if (label.Length > 50) { throw new ArgumentOutOfRangeException(nameof(label)); } if (string.IsNullOrWhiteSpace(href)) { throw new ArgumentException("Href is required.", nameof(href)); } if (href.Length > 200) { throw new ArgumentOutOfRangeException(nameof(href)); } Label = label; Href = href; SortOrder = sortOrder; IsVisible = isVisible; UpdatedAt = DateTime.UtcNow; } public void SetVisible(bool isVisible) { IsVisible = isVisible; UpdatedAt = DateTime.UtcNow; } }