Adds the music artist alias, area, and work value objects and their enumerations

This commit is contained in:
BinaryAlley committed 2026-10-06 09:14:00 +03:00
1 parent bf8b49653d
commit e20e244a04
12 files changed
+1389

No files matched your search

@@ -0,0 +1,32 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the gender of a music artist, applicable only to artists that are persons or characters.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MusicArtistGender
{
/// <summary>
/// The artist identifies as male.
/// </summary>
Male,
/// <summary>
/// The artist identifies as female.
/// </summary>
Female,
/// <summary>
/// The artist identifies with a gender other than male or female.
/// </summary>
Other,
/// <summary>
/// The gender of the artist is not applicable, or is deliberately not stated.
/// </summary>
NotApplicable
}
@@ -0,0 +1,42 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the type of a music artist, describing whether the artist is an individual, an ensemble, or something else.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MusicArtistType
{
/// <summary>
/// The artist is an individual person.
/// </summary>
Person,
/// <summary>
/// The artist is a group of people that may or may not have a distinctive name.
/// </summary>
Group,
/// <summary>
/// The artist is an orchestra, a large instrumental ensemble.
/// </summary>
Orchestra,
/// <summary>
/// The artist is a choir or chorus, a large vocal ensemble.
/// </summary>
Choir,
/// <summary>
/// The artist is an individual fictional character.
/// </summary>
Character,
/// <summary>
/// The type of the artist does not fit into any of the known categories.
/// </summary>
Other
}
@@ -0,0 +1,132 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the outermost physical packaging of a music release.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MusicReleasePackaging
{
/// <summary>
/// The release is a book with a sleeve containing a medium, usually a compact disc.
/// </summary>
Book,
/// <summary>
/// The release is a box with a lid or an opening that contains the medium and other packaging, like posters and a booklet.
/// </summary>
Box,
/// <summary>
/// The release is a sleeve made of paper, paperboard, or cardboard.
/// </summary>
CardboardPaperSleeve,
/// <summary>
/// The release is a regular plastic case for a cassette.
/// </summary>
CassetteCase,
/// <summary>
/// The release is a minimalistic plastic case where the back and the front are kept together by a small hinge.
/// </summary>
ClamshellCase,
/// <summary>
/// The release is a bounded booklet, usually in hardcover, with a sleeve bound to its spine that houses a compact disc.
/// </summary>
Digibook,
/// <summary>
/// The release is a folded cardboard compact disc packaging that has a small pocket on one side for the disc.
/// </summary>
Digifile,
/// <summary>
/// The release is a folded case, typically made of coated paperboard, with one or more plastic trays glued into it.
/// </summary>
Digipak,
/// <summary>
/// The release is a pouch-like package with an internal mechanism that pushes the contents out when the lid flap is opened.
/// </summary>
DiscboxSlider,
/// <summary>
/// The release is a double-sided, double-width jewel case normally holding two to four compact discs.
/// </summary>
Fatbox,
/// <summary>
/// The release is a cardboard sleeve that folds in halves, thirds, or more, and can hold multiple records, compact discs, booklets, or posters.
/// </summary>
GatefoldCover,
/// <summary>
/// The release is the traditional compact disc case, made of hard, brittle plastic.
/// </summary>
JewelCase,
/// <summary>
/// The release is the traditional DVD case, made of soft plastic with a thin transparent cover protecting the artwork.
/// </summary>
KeepCase,
/// <summary>
/// The release is a large cardboard box, often used to sell compact discs in North America so that they would fit vinyl racks.
/// </summary>
Longbox,
/// <summary>
/// The release is an often decorated metal tin containing one or more compact discs.
/// </summary>
MetalTin,
/// <summary>
/// The release is a sleeve made entirely of plastic that holds the medium and the other parts of the album.
/// </summary>
PlasticSleeve,
/// <summary>
/// The release is a box with openings at its two ends that contains a tray holding the medium.
/// </summary>
Slidepack,
/// <summary>
/// The release is a thinner jewel case, commonly used for compact disc singles.
/// </summary>
SlimJewelCase,
/// <summary>
/// The release is a four or five-sided box that surrounds a second inner package such as a jewel case.
/// </summary>
Slipcase,
/// <summary>
/// The release is a digipak-like case held together with a snapping plastic closure.
/// </summary>
SnapCase,
/// <summary>
/// The release is a cardboard jacket, commonly used for 8cm compact disc singles in Japan.
/// </summary>
SnapPack,
/// <summary>
/// The release is a case similar to the regular jewel case, but with rounded corners and a latch closing mechanism.
/// </summary>
SuperJewelBox,
/// <summary>
/// The packaging of the release does not fit into any of the known categories.
/// </summary>
Other,
/// <summary>
/// The release has no packaging at all, which is common for digital media.
/// </summary>
None
}
@@ -0,0 +1,111 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Errors;
using Lumina.Domain.Common.Models.Core;
using Lumina.Domain.Common.Primitives;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate.ValueObjects;
/// <summary>
/// Value Object for a MusicBrainz area, the geographic area a music artist is associated with.
/// </summary>
[DebuggerDisplay("{Name}")]
public sealed class MusicArea : ValueObject
{
/// <summary>
/// Gets the MusicBrainz identifier of the area.
/// </summary>
public MusicBrainzId MusicBrainzAreaId { get; }
/// <summary>
/// Gets the name of the area.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the optional sort name of the area.
/// </summary>
public Optional<string> SortName { get; }
/// <summary>
/// Gets the optional disambiguation comment of the area.
/// </summary>
public Optional<string> Disambiguation { get; }
/// <summary>
/// Gets the optional MusicBrainz type of the area (e.g., Country, City).
/// </summary>
public Optional<string> Type { get; }
/// <summary>
/// Gets the optional ISO 3166 code of the area.
/// </summary>
public Optional<string> Iso3166Code { get; }
/// <summary>
/// Initializes a new instance of the <see cref="MusicArea"/> class.
/// </summary>
/// <param name="musicBrainzAreaId">The MusicBrainz identifier of the area.</param>
/// <param name="name">The name of the area.</param>
/// <param name="sortName">The optional sort name of the area.</param>
/// <param name="disambiguation">The optional disambiguation comment of the area.</param>
/// <param name="type">The optional MusicBrainz type of the area.</param>
/// <param name="iso3166Code">The optional ISO 3166 code of the area.</param>
private MusicArea(
MusicBrainzId musicBrainzAreaId,
string name,
Optional<string> sortName,
Optional<string> disambiguation,
Optional<string> type,
Optional<string> iso3166Code)
{
MusicBrainzAreaId = musicBrainzAreaId;
Name = name;
SortName = sortName;
Disambiguation = disambiguation;
Type = type;
Iso3166Code = iso3166Code;
}
/// <summary>
/// Creates a new instance of the <see cref="MusicArea"/> class.
/// </summary>
/// <param name="musicBrainzAreaId">The MusicBrainz identifier of the area.</param>
/// <param name="name">The name of the area.</param>
/// <param name="sortName">The optional sort name of the area.</param>
/// <param name="disambiguation">The optional disambiguation comment of the area.</param>
/// <param name="type">The optional MusicBrainz type of the area.</param>
/// <param name="iso3166Code">The optional ISO 3166 code of the area.</param>
/// <returns>
/// An <see cref="Result{TValue}"/> containing either a successfully created <see cref="MusicArea"/>, or an error message.
/// </returns>
public static Result<MusicArea> Create(
MusicBrainzId musicBrainzAreaId,
string name,
Optional<string> sortName,
Optional<string> disambiguation,
Optional<string> type,
Optional<string> iso3166Code)
{
if (string.IsNullOrWhiteSpace(name))
return Errors.Music.AreaNameCannotBeEmpty;
return new MusicArea(musicBrainzAreaId, name.Trim(), sortName, disambiguation, type, iso3166Code);
}
/// <summary>
/// Gets the list of items that define equality of the object.
/// </summary>
/// <returns>A list of items defining the equality.</returns>
public override IEnumerable<object> GetEqualityComponents()
{
yield return MusicBrainzAreaId;
yield return Name;
yield return SortName;
yield return Disambiguation;
yield return Type;
yield return Iso3166Code;
}
}
@@ -0,0 +1,134 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Errors;
using Lumina.Domain.Common.Models.Core;
using Lumina.Domain.Common.Primitives;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate.ValueObjects;
/// <summary>
/// Value Object for an alternative name of a music artist.
/// </summary>
[DebuggerDisplay("{Name}")]
public sealed class MusicArtistAlias : ValueObject
{
/// <summary>
/// Gets the name of the alias.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the optional sort name of the alias.
/// </summary>
public Optional<string> SortName { get; }
/// <summary>
/// Gets the optional type of the alias (e.g., Artist name, Search hint).
/// </summary>
public Optional<string> Type { get; }
/// <summary>
/// Gets the optional locale the alias is used in.
/// </summary>
public Optional<string> Locale { get; }
/// <summary>
/// Gets a value indicating whether this is the primary alias of the artist.
/// </summary>
public bool IsPrimary { get; }
/// <summary>
/// Gets the optional date the alias began being used.
/// </summary>
public Optional<DateOnly> BeginDate { get; }
/// <summary>
/// Gets the optional date the alias stopped being used.
/// </summary>
public Optional<DateOnly> EndDate { get; }
/// <summary>
/// Gets a value indicating whether the alias is no longer used.
/// </summary>
public bool IsEnded { get; }
/// <summary>
/// Initializes a new instance of the <see cref="MusicArtistAlias"/> class.
/// </summary>
/// <param name="name">The name of the alias.</param>
/// <param name="sortName">The optional sort name of the alias.</param>
/// <param name="type">The optional type of the alias.</param>
/// <param name="locale">The optional locale the alias is used in.</param>
/// <param name="isPrimary">Whether this is the primary alias of the artist.</param>
/// <param name="beginDate">The optional date the alias began being used.</param>
/// <param name="endDate">The optional date the alias stopped being used.</param>
/// <param name="isEnded">Whether the alias is no longer used.</param>
private MusicArtistAlias(
string name,
Optional<string> sortName,
Optional<string> type,
Optional<string> locale,
bool isPrimary,
Optional<DateOnly> beginDate,
Optional<DateOnly> endDate,
bool isEnded)
{
Name = name;
SortName = sortName;
Type = type;
Locale = locale;
IsPrimary = isPrimary;
BeginDate = beginDate;
EndDate = endDate;
IsEnded = isEnded;
}
/// <summary>
/// Creates a new instance of the <see cref="MusicArtistAlias"/> class.
/// </summary>
/// <param name="name">The name of the alias.</param>
/// <param name="sortName">The optional sort name of the alias.</param>
/// <param name="type">The optional type of the alias.</param>
/// <param name="locale">The optional locale the alias is used in.</param>
/// <param name="isPrimary">Whether this is the primary alias of the artist.</param>
/// <param name="beginDate">The optional date the alias began being used.</param>
/// <param name="endDate">The optional date the alias stopped being used.</param>
/// <param name="isEnded">Whether the alias is no longer used.</param>
/// <returns>
/// An <see cref="Result{TValue}"/> containing either a successfully created <see cref="MusicArtistAlias"/>, or an error message.
/// </returns>
public static Result<MusicArtistAlias> Create(
string name,
Optional<string> sortName,
Optional<string> type,
Optional<string> locale,
bool isPrimary,
Optional<DateOnly> beginDate,
Optional<DateOnly> endDate,
bool isEnded)
{
if (string.IsNullOrWhiteSpace(name))
return Errors.Music.ArtistAliasNameCannotBeEmpty;
return new MusicArtistAlias(name.Trim(), sortName, type, locale, isPrimary, beginDate, endDate, isEnded);
}
/// <summary>
/// Gets the list of items that define equality of the object.
/// </summary>
/// <returns>A list of items defining the equality.</returns>
public override IEnumerable<object> GetEqualityComponents()
{
yield return Name;
yield return SortName;
yield return Type;
yield return Locale;
yield return IsPrimary;
yield return BeginDate;
yield return EndDate;
yield return IsEnded;
}
}
@@ -0,0 +1,106 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Errors;
using Lumina.Domain.Common.Models.Core;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Common.ValueObjects.Metadata;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate.ValueObjects;
/// <summary>
/// Value Object for a MusicBrainz work, the musical composition a track is a recording of.
/// </summary>
[DebuggerDisplay("{Title}")]
public sealed class MusicWork : ValueObject
{
private readonly List<LanguageInfo> _languages;
private readonly List<string> _iswcs;
/// <summary>
/// Gets the MusicBrainz identifier of the work.
/// </summary>
public MusicBrainzId MusicBrainzWorkId { get; }
/// <summary>
/// Gets the title of the work.
/// </summary>
public string Title { get; }
/// <summary>
/// Gets the optional MusicBrainz type of the work (e.g., Song).
/// </summary>
public Optional<string> Type { get; }
/// <summary>
/// Gets the list of languages of the work.
/// </summary>
public IReadOnlyCollection<LanguageInfo> Languages => _languages.AsReadOnly();
/// <summary>
/// Gets the list of ISWC (International Standard Musical Work Code) of the work.
/// </summary>
public IReadOnlyCollection<string> Iswcs => _iswcs.AsReadOnly();
/// <summary>
/// Initializes a new instance of the <see cref="MusicWork"/> class.
/// </summary>
/// <param name="musicBrainzWorkId">The MusicBrainz identifier of the work.</param>
/// <param name="title">The title of the work.</param>
/// <param name="type">The optional MusicBrainz type of the work.</param>
/// <param name="languages">The list of languages of the work.</param>
/// <param name="iswcs">The list of ISWC of the work.</param>
private MusicWork(
MusicBrainzId musicBrainzWorkId,
string title,
Optional<string> type,
List<LanguageInfo> languages,
List<string> iswcs)
{
MusicBrainzWorkId = musicBrainzWorkId;
Title = title;
Type = type;
_languages = languages;
_iswcs = iswcs;
}
/// <summary>
/// Creates a new instance of the <see cref="MusicWork"/> class.
/// </summary>
/// <param name="musicBrainzWorkId">The MusicBrainz identifier of the work.</param>
/// <param name="title">The title of the work.</param>
/// <param name="type">The optional MusicBrainz type of the work.</param>
/// <param name="languages">The list of languages of the work.</param>
/// <param name="iswcs">The list of ISWC of the work.</param>
/// <returns>
/// An <see cref="Result{TValue}"/> containing either a successfully created <see cref="MusicWork"/>, or an error message.
/// </returns>
public static Result<MusicWork> Create(
MusicBrainzId musicBrainzWorkId,
string title,
Optional<string> type,
List<LanguageInfo> languages,
List<string> iswcs)
{
if (string.IsNullOrWhiteSpace(title))
return Errors.Music.WorkTitleCannotBeEmpty;
return new MusicWork(musicBrainzWorkId, title.Trim(), type, languages, iswcs);
}
/// <summary>
/// Gets the list of items that define equality of the object.
/// </summary>
/// <returns>A list of items defining the equality.</returns>
public override IEnumerable<object> GetEqualityComponents()
{
yield return MusicBrainzWorkId;
yield return Title;
yield return Type;
foreach (LanguageInfo language in _languages)
yield return language;
foreach (string iswc in _iswcs)
yield return iswc;
}
}