namespace AmigaDB.VideoRenderer.Models;

public sealed record AppSettings(
    string OutputFolder,
    string EndCardPath,
    string FfmpegPath,
    string FfprobePath,
    string PreviewPlayerPath,
    string Theme,
    string Encoder,
    string TrimStart,
    string FadeSeconds,
    string EndCardHoldSeconds,
    string ThumbnailInterval)
{
    public static AppSettings Default(string outputFolder) => new(
        outputFolder,
        "",
        "",
        "",
        "",
        "Dark",
        "Auto",
        "4.414",
        "3",
        "4",
        "10");

    public AppSettings Normalize(string fallbackOutputFolder) => new(
        string.IsNullOrWhiteSpace(OutputFolder) ? fallbackOutputFolder : OutputFolder,
        EndCardPath ?? "",
        FfmpegPath ?? "",
        FfprobePath ?? "",
        PreviewPlayerPath ?? "",
        string.IsNullOrWhiteSpace(Theme) ? "Dark" : Theme,
        string.IsNullOrWhiteSpace(Encoder) ? "Auto" : Encoder,
        string.IsNullOrWhiteSpace(TrimStart) ? "4.414" : TrimStart,
        string.IsNullOrWhiteSpace(FadeSeconds) ? "3" : FadeSeconds,
        string.IsNullOrWhiteSpace(EndCardHoldSeconds) ? "4" : EndCardHoldSeconds,
        string.IsNullOrWhiteSpace(ThumbnailInterval) ? "10" : ThumbnailInterval);
}
