using ErsatzTV.Application.Artworks;
using ErsatzTV.Core.Api.Watermarks;
using ErsatzTV.Core.Domain;

namespace ErsatzTV.Application.Watermarks;

internal static class Mapper
{
    internal static WatermarkResponseModel ProjectToResponseModel(ChannelWatermark watermark) =>
        new(watermark.Id, watermark.Name, watermark.ImageSource);

    internal static WatermarkFullResponseModel ProjectToFullResponseModel(ChannelWatermark watermark) =>
        new(
            watermark.Id,
            watermark.Name,
            watermark.Mode,
            watermark.ImageSource,
            watermark.Image,
            watermark.OriginalContentType,
            watermark.Location,
            watermark.Size,
            watermark.WidthPercent,
            watermark.HorizontalMarginPercent,
            watermark.VerticalMarginPercent,
            watermark.FrequencyMinutes,
            watermark.DurationSeconds,
            watermark.Opacity,
            watermark.OpacityExpression,
            watermark.ZIndex,
            watermark.PlaceWithinSourceContent);

    public static WatermarkViewModel ProjectToViewModel(ChannelWatermark watermark) =>
        new(
            watermark.Id,
            new ArtworkContentTypeModel(watermark.Image, watermark.OriginalContentType),
            watermark.Name,
            watermark.Mode,
            watermark.ImageSource,
            watermark.Location,
            watermark.Size,
            watermark.WidthPercent,
            watermark.HorizontalMarginPercent,
            watermark.VerticalMarginPercent,
            watermark.FrequencyMinutes,
            watermark.DurationSeconds,
            watermark.Opacity,
            watermark.PlaceWithinSourceContent,
            watermark.OpacityExpression,
            watermark.ZIndex);
}
