#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using Lumina.Application.Common.DTO.Pagination;
using Lumina.Contracts.Responses.Common;
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using System.Collections.Generic;
using System.Linq;
#endregion
namespace Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
///
/// Extension methods for converting .
///
public static class AlbumLiteRowMapping
{
///
/// Converts to .
///
/// The read model to be converted.
/// The converted response.
public static AlbumLiteResponse ToResponse(this AlbumLiteRow readModel)
{
return new AlbumLiteResponse(
readModel.Id,
readModel.Title,
readModel.TotalTracks);
}
///
/// Converts to a collection of .
///
/// The read models to be converted.
/// The converted responses.
public static IReadOnlyList ToResponses(this IEnumerable readModels)
{
return [.. readModels.Select(readModel => readModel.ToResponse())];
}
///
/// Converts to a paginated collection of .
///
/// The paginated read models to be converted.
/// The converted paginated responses.
public static PaginatedResponse ToResponses(this PaginatedResultDto readModels)
{
return new PaginatedResponse
{
Data = readModels.Data.ToResponses(),
CurrentPage = readModels.CurrentPage,
PerPage = readModels.PerPage,
Count = readModels.Count,
NumberOfPages = readModels.NumberOfPages
};
}
}