namespace TeamsISO.Engine.Domain;

public sealed record FrameProcessingSettings(
    TargetFramerate Framerate,
    TargetResolution Resolution,
    AspectMode Aspect,
    AudioMode Audio)
{
    public static readonly FrameProcessingSettings Default =
        new(TargetFramerate.Fps59_94, TargetResolution.R1080p, AspectMode.Pillarbox, AudioMode.Auto);

    /// <summary>Returns the framerate enum value as a numeric frames-per-second.</summary>
    public double FramerateHz => Framerate switch
    {
        TargetFramerate.Fps23_976 => 24000.0 / 1001.0,
        TargetFramerate.Fps24     => 24.0,
        TargetFramerate.Fps25     => 25.0,
        TargetFramerate.Fps29_97  => 30000.0 / 1001.0,
        TargetFramerate.Fps30     => 30.0,
        TargetFramerate.Fps50     => 50.0,
        TargetFramerate.Fps59_94  => 60000.0 / 1001.0,
        TargetFramerate.Fps60     => 60.0,
        _ => throw new InvalidOperationException($"Unknown framerate: {Framerate}")
    };

    /// <summary>Returns the resolution as (width, height).</summary>
    public (int Width, int Height) ResolutionSize => Resolution switch
    {
        TargetResolution.R720p  => (1280, 720),
        TargetResolution.R1080p => (1920, 1080),
        TargetResolution.R4K    => (3840, 2160),
        _ => throw new InvalidOperationException($"Unknown resolution: {Resolution}")
    };
}
