namespace NexusShell.Models;

public enum NexusConsoleAction
{
    None,
    ClearOutput,
    ExitConsole,
    OpenBrowser,
    OpenFiles,
    RestartShell,
}

public sealed class NexusCommandResult
{
    public bool Allowed { get; init; } = true;
    public bool Success { get; init; } = true;
    public IReadOnlyList<string> Lines { get; init; } = [];
    public NexusConsoleAction Action { get; init; } = NexusConsoleAction.None;
    public string? ActionArgument { get; init; }

    public static NexusCommandResult Output(params string[] lines) =>
        new() { Lines = lines };

    public static NexusCommandResult Blocked(string message) =>
        new() { Allowed = false, Success = false, Lines = [message] };

    public static NexusCommandResult Unknown() =>
        new() { Success = false, Lines = ["Unknown Nexus command. Type help."] };

    public static NexusCommandResult WithAction(NexusConsoleAction action, params string[] lines) =>
        new() { Lines = lines, Action = action };

    public static NexusCommandResult WithAction(NexusConsoleAction action, string? argument, params string[] lines) =>
        new() { Lines = lines, Action = action, ActionArgument = argument };
}
