using Butter.Dtos.Album;
using Lactose.Models;

namespace Lactose.Mapper;

/// <summary>
/// provides mapping methods for converting Album objects to DTOs. 
/// </summary>
public static class AlbumMapper {
    /// <summary>
    /// Maps an Album object to an AlbumFullDto object.
    /// </summary>
    /// <param name="album">The album to map.</param>
    /// <returns>An AlbumFullDto object.</returns>
    public static AlbumFullDto ToAlbumFullDto(this Album album) => new AlbumFullDto {
        Id     = album.Id,
        Name   = album.Title,
        Owner  = album.UserOwnerId,
        Person = album.PersonOwnerId,
        Images = album.Assets!.Select(asset => asset.Id).ToList()
    };
    
    public static AlbumPreviewDto ToAlbumPreviewDto(this Album album) => new AlbumPreviewDto {
        Id     = album.Id,
        Name   = album.Title,
        Owner  = album.UserOwnerId,
        Person = album.PersonOwnerId
    };
    
    
    
}
