Files
Nemera/src/Nemera.Application/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntity.cs
T

146 lines
5.6 KiB
C#

#region ========================================================================= USING =====================================================================================
using Nemera.Application.Common.DataAccess.Entities.Common;
using Nemera.Application.Common.DataAccess.Entities.UsersManagement;
using Nemera.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Nemera.Application.Common.DataAccess.Entities.MediaLibrary.Management;
/// <summary>
/// Repository entity for a media library.
/// </summary>
[DebuggerDisplay("Title: {Title}")]
public class LibraryEntity : IStorageEntity, IAuditableEntity
{
/// <summary>
/// Gets the Id of the media library.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets the Id of the user that owns the media library.
/// </summary>
public required Guid UserId { get; init; }
/// <summary>
/// Gets or sets the title of the media library.
/// </summary>
public required string Title { get; set; }
/// <summary>
/// Gets or sets the path of the image file used as the cover for the library.
/// </summary>
public string? CoverImage { get; set; }
/// <summary>
/// Gets or sets the type of the media library.
/// </summary>
public required LibraryType LibraryType { get; set; }
/// <summary>
/// Gets the list of file system paths that make up the media library.
/// </summary>
public required ICollection<LibraryContentLocationEntity> ContentLocations { get; init; } = [];
/// <summary>
/// Gets the ordered parts of the template describing the structure of the media library on disk.
/// </summary>
public ICollection<LibraryPathTemplatePartEntity> PathTemplateParts { get; init; } = [];
/// <summary>
/// Gets the list of scans of the media library.
/// </summary>
public ICollection<LibraryScanEntity> LibraryScans { get; init; } = [];
/// <summary>
/// Gets whether this media library is enabled or not. A disabled media library is never shown or changed.
/// </summary>
public bool IsEnabled { get; init; }
/// <summary>
/// Gets whether this media library is locked or not. A locked media library is displayed, but is never changed or updated.
/// </summary>
public bool IsLocked { get; init; }
/// <summary>
/// Gets whether this media library should update the metadata of its elements from the web, or not.
/// </summary>
public bool CanDownloadMetadataFromWeb { get; init; }
/// <summary>
/// Gets whether this media library should copy the downloaded metadata into the media library content locations, or not.
/// </summary>
public bool ShouldSaveMetadataInMediaDirectories { get; init; }
/// <summary>
/// Gets or sets whether the unchanged directories are skipped during the scan of the media library.
/// </summary>
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; init; }
/// <summary>
/// Gets whether hidden files and directories are skipped during the scan of the media library.
/// </summary>
public bool ShouldSkipHiddenFilesAndDirectoriesDuringScan { get; init; }
/// <summary>
/// Gets whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.
/// </summary>
public bool IsContentOnSsd { get; init; }
/// <summary>
/// Gets a value indicating whether the consumption progress of the media library items is tracked.
/// </summary>
public bool ShouldTrackConsumptionProgress { get; init; }
/// <summary>
/// Gets the percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled.
/// </summary>
public int? CompletionThresholdPercentage { get; init; }
/// <summary>
/// Gets or sets the fingerprint of the metadata provider configuration of the media library, used to detect
/// whether the configuration changed since the last scan, and thus whether the books need re-enrichment.
/// </summary>
public string? MetadataProvidersConfigurationFingerprint { get; set; }
/// <summary>
/// Gets or sets the fingerprint of the artwork provider configuration of the media library, used to detect
/// whether the configuration changed since the last scan, and thus whether the books need their artwork re-resolved.
/// </summary>
public string? ArtworkProvidersConfigurationFingerprint { get; set; }
/// <summary>
/// Gets or sets the fingerprint of the path template of the media library, used to detect whether the template
/// changed since the last scan, and thus whether the metadata needs to be derived from the paths again.
/// </summary>
public string? PathTemplateFingerprint { get; set; }
/// <summary>
/// Gets the user that owns the media library.
/// </summary>
public UserEntity User { get; init; } = null!;
/// <summary>
/// Gets or sets the time and date when the entity was added.
/// </summary>
public DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the Id of the user that created the entity.
/// </summary>
public Guid CreatedBy { get; set; }
/// <summary>
/// Gets or sets the optional time and date when the entity was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional Id of the user that updated the entity.
/// </summary>
public Guid? UpdatedBy { get; set; }
}