#region ========================================================================= USING ===================================================================================== using ErrorOr; using Lumina.Domain.Common.Models.Core; using Lumina.Domain.SharedKernel.Common.Errors; using System.Collections.Generic; using System.Diagnostics; #endregion namespace Lumina.Domain.Common.ValueObjects.Metadata; /// /// Value Object for the genres of a media element. /// [DebuggerDisplay("{Name}")] public class Genre : ValueObject { /// /// Gets the name of the genre element of the media item. /// public string Name { get; } /// /// Initializes a new instance of the class. /// /// The value representing this object. private Genre(string name) { Name = name.Trim(); } /// /// Creates a new instance of the class. /// /// The value of the genre. /// /// An containing either a successfully created , or an error message. /// public static ErrorOr Create(string? name) { if (string.IsNullOrWhiteSpace(name)) return Errors.Metadata.GenreNameCannotBeEmpty; return new Genre(name); } /// public override IEnumerable GetEqualityComponents() { yield return Name; } /// /// Customized ToString() method. /// /// Custom string value showing relevant data for current class. public override string ToString() { return Name; } }