Adds playlist management and playback

This commit is contained in:
BinaryAlley committed 2026-10-21 16:30:58 +03:00
1 parent 009a0c8156
commit 9889c86c76
296 files changed
+18830 -367

No files matched your search

@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Primitives;
#endregion
namespace Lumina.Domain.Common.Errors;
/// <summary>
/// Playlist error types.
/// </summary>
public static partial class Errors
{
public static class Playlists
{
public static Error PlaylistNotFound => Error.NotFound(description: nameof(PlaylistNotFound));
public static Error PlaylistAlreadyExists => Error.Conflict(description: nameof(PlaylistAlreadyExists));
public static Error PlaylistIdCannotBeEmpty => Error.Validation(description: nameof(PlaylistIdCannotBeEmpty));
public static Error PlaylistEntryIdCannotBeEmpty => Error.Validation(description: nameof(PlaylistEntryIdCannotBeEmpty));
public static Error PlaylistNameCannotBeEmpty => Error.Validation(description: nameof(PlaylistNameCannotBeEmpty));
public static Error PlaylistNameMustBeMaximum255CharactersLong => Error.Validation(description: nameof(PlaylistNameMustBeMaximum255CharactersLong));
public static Error PlaylistDescriptionMustBeMaximum2000CharactersLong => Error.Validation(description: nameof(PlaylistDescriptionMustBeMaximum2000CharactersLong));
public static Error PlaylistTypeIsInvalid => Error.Validation(description: nameof(PlaylistTypeIsInvalid));
public static Error PlaylistDoesNotAcceptMediaItems => Error.Forbidden(description: nameof(PlaylistDoesNotAcceptMediaItems));
public static Error PlaylistEntryNotFound => Error.NotFound(description: nameof(PlaylistEntryNotFound));
public static Error PlaylistEntryPositionsAreInvalid => Error.Validation(description: nameof(PlaylistEntryPositionsAreInvalid));
public static Error PlaylistMoveTargetPositionIsInvalid => Error.Validation(description: nameof(PlaylistMoveTargetPositionIsInvalid));
public static Error PlaylistEntryWindowOffsetIsInvalid => Error.Validation(description: nameof(PlaylistEntryWindowOffsetIsInvalid));
public static Error PlaylistEntryWindowLimitIsInvalid => Error.Validation(description: nameof(PlaylistEntryWindowLimitIsInvalid));
}
}
@@ -0,0 +1,54 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Models.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.ExternalIdentifiers.MediaLibraryBoundedContext.MediaItemAggregate;
/// <summary>
/// Value Object for the Id of a media item, duplicated from the media library bounded contexts to keep the cross bounded context references decoupled.
/// </summary>
/// <remarks>
/// The kind of media item is carried by the playlist entry and by the playlist type, so this identifier stays generic across music tracks and video files.
/// </remarks>
[DebuggerDisplay("{Value}")]
public sealed class MediaItemId : EntityId<Guid>
{
/// <summary>
/// Initializes a new instance of the <see cref="MediaItemId"/> class.
/// </summary>
/// <param name="value">The value representing this object.</param>
private MediaItemId(Guid value) : base(value)
{
}
/// <summary>
/// Creates a new instance of the <see cref="MediaItemId"/> class.
/// </summary>
/// <returns>The created <see cref="MediaItemId"/> instance.</returns>
public static MediaItemId CreateUnique()
{
return new MediaItemId(Guid.NewGuid());
}
/// <summary>
/// Creates a new instance of the <see cref="MediaItemId"/> class, from a pre-existing <paramref name="value"/>.
/// </summary>
/// <param name="value">The value used to create the <see cref="MediaItemId"/> instance.</param>
/// <returns>The created <see cref="MediaItemId"/> instance.</returns>
public static MediaItemId Create(Guid value)
{
return new MediaItemId(value);
}
/// <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 Value;
}
}
@@ -0,0 +1,51 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Models.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.ExternalIdentifiers.UserManagementBoundedContext.UserAggregate;
/// <summary>
/// Value Object for the Id of a user, duplicated from the UserManagement bounded context to keep the cross bounded context references decoupled.
/// </summary>
[DebuggerDisplay("{Value}")]
public sealed class UserId : EntityId<Guid>
{
/// <summary>
/// Initializes a new instance of the <see cref="UserId"/> class.
/// </summary>
/// <param name="value">The value representing this object.</param>
private UserId(Guid value) : base(value)
{
}
/// <summary>
/// Creates a new instance of the <see cref="UserId"/> class.
/// </summary>
/// <returns>The created <see cref="UserId"/> instance.</returns>
public static UserId CreateUnique()
{
return new UserId(Guid.NewGuid());
}
/// <summary>
/// Creates a new instance of the <see cref="UserId"/> class, from a pre-existing <paramref name="value"/>.
/// </summary>
/// <param name="value">The value used to create the <see cref="UserId"/> instance.</param>
/// <returns>The created <see cref="UserId"/> instance.</returns>
public static UserId Create(Guid value)
{
return new UserId(value);
}
/// <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 Value;
}
}
@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Models.Core;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.ExternalIdentifiers.MediaLibraryBoundedContext.MediaItemAggregate;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.ValueObjects;
using Lumina.Domain.SharedKernel.Common.Enums.Playlists;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.Entities;
/// <summary>
/// Entity for an ordered entry of a playlist.
/// </summary>
[DebuggerDisplay("Id: {Id.Value}; MediaItemId: {MediaItemId.Value}; MediaItemType: {MediaItemType}; Position: {Position}")]
public sealed class PlaylistEntry : Entity<PlaylistEntryId>
{
/// <summary>
/// Gets the Id of the media item referenced by the entry.
/// </summary>
public MediaItemId MediaItemId { get; private set; }
/// <summary>
/// Gets the kind of media item referenced by the entry.
/// </summary>
public PlaylistMediaItemType MediaItemType { get; private set; }
/// <summary>
/// Gets the sparse order key of the entry in the ordered entries of the playlist.
/// </summary>
public long Position { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="PlaylistEntry"/> class.
/// </summary>
/// <param name="id">The object representing the unique identifier of the entry.</param>
/// <param name="mediaItemId">The Id of the media item referenced by the entry.</param>
/// <param name="mediaItemType">The kind of media item referenced by the entry.</param>
/// <param name="position">The sparse order key of the entry in the ordered entries of the playlist.</param>
private PlaylistEntry(PlaylistEntryId id, MediaItemId mediaItemId, PlaylistMediaItemType mediaItemType, long position) : base(id)
{
Id = id;
MediaItemId = mediaItemId;
MediaItemType = mediaItemType;
Position = position;
}
/// <summary>
/// Creates a new instance of the <see cref="PlaylistEntry"/> class, with a pre-existing <paramref name="id"/>.
/// </summary>
/// <param name="id">The object representing the unique identifier of the entry.</param>
/// <param name="mediaItemId">The Id of the media item referenced by the entry.</param>
/// <param name="mediaItemType">The kind of media item referenced by the entry.</param>
/// <param name="position">The sparse order key of the entry in the ordered entries of the playlist.</param>
/// <returns>
/// An <see cref="Result{TValue}"/> containing either a successfully created <see cref="PlaylistEntry"/>, or an error message.
/// </returns>
public static Result<PlaylistEntry> Create(PlaylistEntryId id, MediaItemId mediaItemId, PlaylistMediaItemType mediaItemType, long position)
{
return new PlaylistEntry(id, mediaItemId, mediaItemType, position);
}
}
@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Events;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.ExternalIdentifiers.UserManagementBoundedContext.UserAggregate;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.ValueObjects;
using Lumina.Domain.SharedKernel.Common.Enums.Playlists;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.Events;
/// <summary>
/// Domain event raised when a playlist is created.
/// </summary>
/// <param name="Id">The unique identifier of the domain event.</param>
/// <param name="PlaylistId">The unique identifier of the playlist.</param>
/// <param name="UserId">The unique identifier of the user that owns the playlist.</param>
/// <param name="Name">The name of the playlist.</param>
/// <param name="Type">The kind of media the playlist holds.</param>
/// <param name="OccurredOnUtc">The date and time when the domain event occurred.</param>
[DebuggerDisplay("PlaylistId: {PlaylistId.Value}; UserId: {UserId.Value}")]
public record PlaylistCreatedDomainEvent(
Guid Id,
PlaylistId PlaylistId,
UserId UserId,
string Name,
PlaylistType Type,
DateTime OccurredOnUtc
) : IDomainEvent;
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Events;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.ExternalIdentifiers.UserManagementBoundedContext.UserAggregate;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.ValueObjects;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.Events;
/// <summary>
/// Domain event raised when a playlist is deleted.
/// </summary>
/// <param name="Id">The unique identifier of the domain event.</param>
/// <param name="PlaylistId">The unique identifier of the playlist.</param>
/// <param name="UserId">The unique identifier of the user that owned the playlist.</param>
/// <param name="OccurredOnUtc">The date and time when the domain event occurred.</param>
[DebuggerDisplay("PlaylistId: {PlaylistId.Value}; UserId: {UserId.Value}")]
public record PlaylistDeletedDomainEvent(
Guid Id,
PlaylistId PlaylistId,
UserId UserId,
DateTime OccurredOnUtc
) : IDomainEvent;
@@ -0,0 +1,26 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Events;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.ExternalIdentifiers.UserManagementBoundedContext.UserAggregate;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.ValueObjects;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.Events;
/// <summary>
/// Domain event raised when the details of a playlist are updated.
/// </summary>
/// <param name="Id">The unique identifier of the domain event.</param>
/// <param name="PlaylistId">The unique identifier of the playlist.</param>
/// <param name="UserId">The unique identifier of the user that owns the playlist.</param>
/// <param name="Name">The new name of the playlist.</param>
/// <param name="OccurredOnUtc">The date and time when the domain event occurred.</param>
[DebuggerDisplay("PlaylistId: {PlaylistId.Value}; Name: {Name}")]
public record PlaylistDetailsUpdatedDomainEvent(
Guid Id,
PlaylistId PlaylistId,
UserId UserId,
string Name,
DateTime OccurredOnUtc
) : IDomainEvent;
@@ -0,0 +1,228 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Errors;
using Lumina.Domain.Common.Models.Core;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.ExternalIdentifiers.UserManagementBoundedContext.UserAggregate;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.Entities;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.Events;
using Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.ValueObjects;
using Lumina.Domain.SharedKernel.Common.Enums.Playlists;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate;
/// <summary>
/// Aggregate root for a playlist.
/// </summary>
[DebuggerDisplay("Id: {Id.Value}; Name: {Name}; Type: {Type}")]
public sealed class Playlist : AggregateRoot<PlaylistId>
{
private readonly List<PlaylistEntry> _entries;
/// <summary>
/// Gets the object representing the unique identifier of the user that owns the playlist.
/// </summary>
public UserId UserId { get; private set; }
/// <summary>
/// Gets the name of the playlist.
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Gets the description of the playlist, if applicable.
/// </summary>
public Optional<string> Description { get; private set; }
/// <summary>
/// Gets the kind of media the playlist holds.
/// </summary>
public PlaylistType Type { get; private set; }
/// <summary>
/// Gets a value indicating whether the playlist was marked for deletion in this unit of work.
/// </summary>
public bool IsDeleted { get; private set; }
/// <summary>
/// Gets the ordered entries of the playlist.
/// </summary>
public IReadOnlyCollection<PlaylistEntry> Entries => _entries.AsReadOnly();
/// <summary>
/// Initializes a new instance of the <see cref="Playlist"/> class.
/// </summary>
/// <param name="id">The object representing the unique identifier of the playlist.</param>
/// <param name="userId">The object representing the unique identifier of the user that owns the playlist.</param>
/// <param name="name">The name of the playlist.</param>
/// <param name="description">The optional description of the playlist.</param>
/// <param name="type">The kind of media the playlist holds.</param>
/// <param name="entries">The ordered entries of the playlist.</param>
/// <param name="createdOnUtc">The date and time when the playlist was created.</param>
/// <param name="updatedOnUtc">The date and time when the playlist was last updated.</param>
private Playlist(
PlaylistId id,
UserId userId,
string name,
Optional<string> description,
PlaylistType type,
List<PlaylistEntry> entries,
DateTime createdOnUtc,
Optional<DateTime> updatedOnUtc) : base(id)
{
Id = id;
UserId = userId;
Name = name;
Description = description;
Type = type;
_entries = entries;
CreatedOnUtc = createdOnUtc;
UpdatedOnUtc = updatedOnUtc;
}
/// <summary>
/// Creates a new playlist for the user identified by <paramref name="userId"/>.
/// </summary>
/// <param name="userId">The object representing the unique identifier of the user that owns the playlist.</param>
/// <param name="name">The name of the playlist.</param>
/// <param name="description">The optional description of the playlist.</param>
/// <param name="type">The kind of media the playlist holds.</param>
/// <returns>
/// An <see cref="Result{TValue}"/> containing either a successfully created <see cref="Playlist"/>, or an error message.
/// </returns>
public static Result<Playlist> Create(UserId userId, string name, Optional<string> description, PlaylistType type)
{
DateTime occurredOnUtc = DateTime.UtcNow;
Playlist playlist = new(
PlaylistId.CreateUnique(),
userId,
name,
description,
type,
[],
occurredOnUtc,
Optional<DateTime>.None());
playlist._domainEvents.Add(new PlaylistCreatedDomainEvent(
Guid.NewGuid(),
playlist.Id,
userId,
name,
type,
occurredOnUtc));
return playlist;
}
/// <summary>
/// Creates a new instance of the <see cref="Playlist"/> class, with pre-existing data.
/// </summary>
/// <param name="id">The object representing the unique identifier of the playlist.</param>
/// <param name="userId">The object representing the unique identifier of the user that owns the playlist.</param>
/// <param name="name">The name of the playlist.</param>
/// <param name="description">The optional description of the playlist.</param>
/// <param name="type">The kind of media the playlist holds.</param>
/// <param name="entries">The ordered entries of the playlist.</param>
/// <param name="createdOnUtc">The date and time when the playlist was created.</param>
/// <param name="updatedOnUtc">The date and time when the playlist was last updated.</param>
/// <returns>
/// An <see cref="Result{TValue}"/> containing either a successfully created <see cref="Playlist"/>, or an error message.
/// </returns>
public static Result<Playlist> Create(
PlaylistId id,
UserId userId,
string name,
Optional<string> description,
PlaylistType type,
List<PlaylistEntry> entries,
DateTime createdOnUtc,
Optional<DateTime> updatedOnUtc)
{
if (entries.Any(entry => !CanContain(type, entry.MediaItemType)))
return Errors.Playlists.PlaylistDoesNotAcceptMediaItems;
// The positions are sparse order keys, so they must be unique. The gaps between them are intentional and are not a reason to reject an otherwise readable playlist.
if (!ArePositionsValid(entries))
return Errors.Playlists.PlaylistEntryPositionsAreInvalid;
return new Playlist(id, userId, name, description, type, entries, createdOnUtc, updatedOnUtc);
}
/// <summary>
/// Updates the name and the description of the playlist, without touching its entries.
/// </summary>
/// <param name="name">The name of the playlist.</param>
/// <param name="description">The optional description of the playlist.</param>
/// <returns>An <see cref="Result{TValue}"/> representing either a successful update, or an error.</returns>
public Result<Updated> UpdateDetails(string name, Optional<string> description)
{
bool hasChanged = Name != name
|| Description.HasValue != description.HasValue
|| (Description.HasValue && description.HasValue && Description.Value != description.Value);
if (!hasChanged)
return Result.Updated;
Name = name;
Description = description;
DateTime occurredOnUtc = DateTime.UtcNow;
_domainEvents.Add(new PlaylistDetailsUpdatedDomainEvent(
Guid.NewGuid(),
Id,
UserId,
name,
occurredOnUtc));
return Result.Updated;
}
/// <summary>
/// Marks the playlist as deleted, raising the domain event that announces its deletion.
/// </summary>
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
public Result<Deleted> Delete()
{
if (IsDeleted)
return Result.Deleted;
// Earlier events become irrelevant once the playlist is deleted.
_domainEvents.Clear();
IsDeleted = true;
_domainEvents.Add(new PlaylistDeletedDomainEvent(
Guid.NewGuid(),
Id,
UserId,
DateTime.UtcNow));
return Result.Deleted;
}
/// <summary>
/// Determines whether a playlist of <paramref name="playlistType"/> can contain <paramref name="mediaItemType"/>.
/// </summary>
/// <param name="playlistType">The kind of media the playlist holds.</param>
/// <param name="mediaItemType">The kind of media item referenced by an entry.</param>
/// <returns><see langword="true"/> if the media item type belongs to the playlist type, <see langword="false"/> otherwise.</returns>
public static bool CanContain(PlaylistType playlistType, PlaylistMediaItemType mediaItemType)
{
return playlistType switch
{
PlaylistType.Music => mediaItemType == PlaylistMediaItemType.MusicTrack,
_ => false
};
}
/// <summary>
/// Determines whether the positions of <paramref name="entries"/> are unique.
/// </summary>
/// <param name="entries">The entries whose positions are checked.</param>
/// <returns><see langword="true"/> if the positions are unique, <see langword="false"/> otherwise.</returns>
private static bool ArePositionsValid(IReadOnlyCollection<PlaylistEntry> entries)
{
// The storage enforces unique order keys with a unique index, and the sparse keys are allowed to have wide gaps.
HashSet<long> positions = [];
foreach (PlaylistEntry entry in entries)
if (!positions.Add(entry.Position))
return false;
return true;
}
}
@@ -0,0 +1,51 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Models.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.ValueObjects;
/// <summary>
/// Value Object for the Id of an entry of a playlist.
/// </summary>
[DebuggerDisplay("{Value}")]
public sealed class PlaylistEntryId : EntityId<Guid>
{
/// <summary>
/// Initializes a new instance of the <see cref="PlaylistEntryId"/> class.
/// </summary>
/// <param name="value">The value representing this object.</param>
private PlaylistEntryId(Guid value) : base(value)
{
}
/// <summary>
/// Creates a new instance of the <see cref="PlaylistEntryId"/> class.
/// </summary>
/// <returns>The created <see cref="PlaylistEntryId"/> instance.</returns>
public static PlaylistEntryId CreateUnique()
{
return new PlaylistEntryId(Guid.NewGuid());
}
/// <summary>
/// Creates a new instance of the <see cref="PlaylistEntryId"/> class, from a pre-existing <paramref name="value"/>.
/// </summary>
/// <param name="value">The value used to create the <see cref="PlaylistEntryId"/> instance.</param>
/// <returns>The created <see cref="PlaylistEntryId"/> instance.</returns>
public static PlaylistEntryId Create(Guid value)
{
return new PlaylistEntryId(value);
}
/// <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 Value;
}
}
@@ -0,0 +1,51 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Models.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Domain.Core.BoundedContexts.PlaylistBoundedContext.PlaylistAggregate.ValueObjects;
/// <summary>
/// Value Object for the Id of a playlist.
/// </summary>
[DebuggerDisplay("{Value}")]
public sealed class PlaylistId : EntityId<Guid>
{
/// <summary>
/// Initializes a new instance of the <see cref="PlaylistId"/> class.
/// </summary>
/// <param name="value">The value representing this object.</param>
private PlaylistId(Guid value) : base(value)
{
}
/// <summary>
/// Creates a new instance of the <see cref="PlaylistId"/> class.
/// </summary>
/// <returns>The created <see cref="PlaylistId"/> instance.</returns>
public static PlaylistId CreateUnique()
{
return new PlaylistId(Guid.NewGuid());
}
/// <summary>
/// Creates a new instance of the <see cref="PlaylistId"/> class, from a pre-existing <paramref name="value"/>.
/// </summary>
/// <param name="value">The value used to create the <see cref="PlaylistId"/> instance.</param>
/// <returns>The created <see cref="PlaylistId"/> instance.</returns>
public static PlaylistId Create(Guid value)
{
return new PlaylistId(value);
}
/// <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 Value;
}
}
@@ -8,7 +8,7 @@ using System.Diagnostics;
namespace Lumina.Domain.Core.BoundedContexts.SchedulingBoundedContext.ExternalIdentifiers.UserManagementBoundedContext.UserAggregate;
/// <summary>
/// Value object for the Id of a user, duplicated from the UserManagement bounded context to keep the cross bounded context references decoupled.
/// Value Object for the Id of a user, duplicated from the UserManagement bounded context to keep the cross bounded context references decoupled.
/// </summary>
[DebuggerDisplay("{Value}")]
public sealed class UserId : EntityId<Guid>