namespace NexusInstaller.Models;

public sealed class InstallerOptions
{
    public string InstallRoot { get; init; } = @"C:\NinjaNexusPOC";
    public bool LaunchOnly { get; init; }
    public string? CaptureScreenshotsDir { get; init; }

    public static InstallerOptions Parse(string[] args)
    {
        var installRoot = @"C:\NinjaNexusPOC";
        var launchOnly = false;
        string? captureDir = null;

        for (var i = 0; i < args.Length; i++)
        {
            if (args[i] is "--launch" or "-launch")
            {
                launchOnly = true;
            }
            else if ((args[i] is "--install" or "-install") && i + 1 < args.Length)
            {
                installRoot = args[++i];
            }
            else if ((args[i] is "--capture-screenshots" or "-capture-screenshots") && i + 1 < args.Length)
            {
                captureDir = args[++i];
            }
        }

        return new InstallerOptions
        {
            InstallRoot = installRoot,
            LaunchOnly = launchOnly,
            CaptureScreenshotsDir = captureDir,
        };
    }
}
