using ErsatzTV.Application.FFmpegProfiles;
using ErsatzTV.FFmpeg.OutputFormat;

namespace ErsatzTV.Controllers.Api.Requests;

public record UpdateFFmpegSettingsRequest(
    string FFmpegPath,
    string FFprobePath,
    int DefaultFFmpegProfileId,
    string PreferredAudioLanguageCode,
    bool UseEmbeddedSubtitles,
    bool ExtractEmbeddedSubtitles,
    bool ProbeForInterlacedFrames,
    bool SaveReports,
    int? GlobalWatermarkId,
    int? GlobalFallbackFillerId,
    int HlsSegmenterIdleTimeout,
    int WorkAheadSegmenterLimit,
    int InitialSegmentCount,
    OutputFormatKind HlsDirectOutputFormat,
    string DefaultMpegTsScript)
{
    public UpdateFFmpegSettings ToCommand() =>
        new(
            new FFmpegSettingsViewModel
            {
                FFmpegPath = FFmpegPath,
                FFprobePath = FFprobePath,
                DefaultFFmpegProfileId = DefaultFFmpegProfileId,
                PreferredAudioLanguageCode = PreferredAudioLanguageCode,
                UseEmbeddedSubtitles = UseEmbeddedSubtitles,
                ExtractEmbeddedSubtitles = ExtractEmbeddedSubtitles,
                ProbeForInterlacedFrames = ProbeForInterlacedFrames,
                SaveReports = SaveReports,
                GlobalWatermarkId = GlobalWatermarkId,
                GlobalFallbackFillerId = GlobalFallbackFillerId,
                HlsSegmenterIdleTimeout = HlsSegmenterIdleTimeout,
                WorkAheadSegmenterLimit = WorkAheadSegmenterLimit,
                InitialSegmentCount = InitialSegmentCount,
                HlsDirectOutputFormat = HlsDirectOutputFormat,
                DefaultMpegTsScript = DefaultMpegTsScript
            });
}
