#region ========================================================================= USING ===================================================================================== using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; using Lumina.Application.Common.DataAccess.Repositories.Common.Actions; using Lumina.Application.Common.DataAccess.Repositories.Common.Base; using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Albums; using Lumina.Application.Common.DTO.Pagination; using Lumina.Domain.Common.Primitives; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; #endregion namespace Lumina.Application.Common.DataAccess.Repositories.MusicLibrary; /// /// Interface for the repository for albums. /// public interface IAlbumRepository : IRepository, IInsertRepositoryAction, IUpdateRepositoryAction, IApplyUpdateRepositoryAction, IGetByIdRepositoryAction, IDeleteByIdRepositoryAction { /// /// Gets the albums of the artist identified by that are not soft deleted. /// /// The Id of the artist whose albums are retrieved. /// Cancellation token that can be used to stop the execution. /// An containing either a collection of , or an error. Task>> GetByArtistIdAsync(Guid artistId, CancellationToken cancellationToken); /// /// Gets all the albums of the artist identified by , whether they are soft deleted or not. /// /// The Id of the artist whose albums are retrieved. /// Cancellation token that can be used to stop the execution. /// An containing either a collection of , or an error. Task>> GetByArtistIdIncludingDeletedAsync(Guid artistId, CancellationToken cancellationToken); /// /// Gets the album identified by , whether it is soft deleted or not, without loading its navigation properties. /// /// The Id of the album to get. /// Cancellation token that can be used to stop the execution. /// An containing either the , or an error. Task> GetIncludingDeletedByIdAsync(Guid id, CancellationToken cancellationToken); /// /// Gets the soft deleted album identified by , when its artist is not soft deleted. /// /// The Id of the soft deleted album to get. /// Cancellation token that can be used to stop the execution. /// An containing either the soft deleted , when the album does not exist, is not soft deleted, or its artist is soft deleted, or an error. Task> GetSoftDeletedByIdAsync(Guid id, CancellationToken cancellationToken); /// /// Gets the soft deleted albums of the media library identified by , whose artist is not soft deleted. /// /// The Id of the media library whose soft deleted albums are retrieved. /// Cancellation token that can be used to stop the execution. /// An containing either the soft deleted albums, or an error. Task>> GetSoftDeletedByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken); /// /// Soft deletes the album identified by , without removing its stored metadata or artwork, when another visible album of its artist remains. /// /// The Id of the album to soft delete. /// Cancellation token that can be used to stop the execution. /// An representing either a successful operation, or an error. Task> SoftDeleteByIdAsync(Guid id, CancellationToken cancellationToken); /// /// Restores the soft deleted album identified by . /// /// The Id of the album to restore. /// Cancellation token that can be used to stop the execution. /// An representing either a successful operation, or an error. Task> RestoreSoftDeletedByIdAsync(Guid id, CancellationToken cancellationToken); /// /// Gets the lightweight read models of the albums of the artist identified by , projecting only the fields needed to display the albums in a card-based grid or a list. /// /// The Id of the artist whose albums are retrieved. /// The pagination data that includes the current page and the number of items per page to retrieve. If , all matching albums are returned. /// Cancellation token that can be used to stop the execution. /// An containing either a paginated result of , or an error. Task>> GetAlbumsLiteByArtistIdAsync(Guid artistId, PaginationDataDto? paginationData, CancellationToken cancellationToken); /// /// Gets the album of the artist identified by that has the provided . /// /// The Id of the artist whose album is retrieved. /// The title of the album to retrieve. /// Cancellation token that can be used to stop the execution. /// An containing either the with the provided title, or an error. Task> GetByTitleAsync(Guid artistId, string title, CancellationToken cancellationToken); /// /// Gets the album of the artist identified by that owns a track stored in the provided . /// /// The Id of the artist whose album is retrieved. /// The file system path of the album directory the album owns. /// Cancellation token that can be used to stop the execution. /// An containing either the owning the directory, or an error. Task> GetByTrackDirectoryAsync(Guid artistId, string directoryPath, CancellationToken cancellationToken); /// /// Gets the number of albums of the media library identified by whose metadata has not been enriched yet. /// /// The Id of the media library whose albums are counted. /// Cancellation token that can be used to stop the execution. /// An containing either the number of albums needing their metadata enriched, or an error. Task> GetAlbumsNeedingMetadataCountAsync(Guid libraryId, CancellationToken cancellationToken); /// /// Gets the number of albums of the media library identified by whose artwork has not been resolved yet, /// meaning they have no artwork that is either enriched or confirmed as unavailable. /// /// The Id of the media library whose albums are counted. /// Cancellation token that can be used to stop the execution. /// An containing either the number of albums needing their artwork resolved, or an error. Task> GetAlbumsNeedingArtworkCountAsync(Guid libraryId, CancellationToken cancellationToken); /// /// Gets a page of the albums of the media library identified by whose artwork has not been resolved yet, /// together with their artist, ordered by Id, excluding the provided albums. /// /// The Id of the media library whose albums are retrieved. /// The Ids of the albums that were already processed in the current run and must not be retrieved again. /// The maximum number of albums to retrieve. /// Cancellation token that can be used to stop the execution. /// An containing either a page of albums needing their artwork resolved, or an error. Task>> GetAlbumsNeedingArtworkAsync(Guid libraryId, IReadOnlyCollection excludedAlbumIds, int pageSize, CancellationToken cancellationToken); /// /// Gets the file system path of one track of each of the albums identified by , keyed by the Id of the album. /// /// The Ids of the albums whose track path is retrieved. /// Cancellation token that can be used to stop the execution. /// An containing either the file system path of a track of each album, or an error. Task>> GetFirstTrackPathsByAlbumIdsAsync(IReadOnlyCollection albumIds, CancellationToken cancellationToken); /// /// Resets the metadata enrichment status of all the albums of the media library identified by , /// so that they are re-enriched, because the metadata provider configuration of the library changed. /// /// The Id of the media library whose albums are reset. /// Cancellation token that can be used to stop the execution. /// An representing either a successful operation, or an error. Task> ResetMetadataStatusForLibraryAsync(Guid libraryId, CancellationToken cancellationToken); }