namespace ClaudeDo.Data.Models;

public static class ModelRegistry
{
    public static readonly IReadOnlyList<string> Aliases = new[] { "sonnet", "opus", "haiku" };

    /// <summary>Model aliases ordered cheapest → most capable. Single source for prompt cost guidance.</summary>
    public static readonly IReadOnlyList<string> ByCostAscending = new[] { "haiku", "sonnet", "opus" };

    public const string DefaultAlias = "sonnet";
    public const string PlanningAlias = "opus";

    public const string ListDefaultSentinel = "(default)";
    public const string TaskInheritSentinel = "(inherit)";

    /// <summary>
    /// Validate a model alias from external input. Null/blank → null (inherit).
    /// Returns the canonical lowercase alias; throws on an unknown value.
    /// </summary>
    public static string? NormalizeAlias(string? model)
    {
        var m = model?.Trim();
        if (string.IsNullOrEmpty(m)) return null;
        foreach (var alias in Aliases)
            if (string.Equals(alias, m, StringComparison.OrdinalIgnoreCase))
                return alias;
        throw new ArgumentException($"Unknown model '{model}'. Allowed: {string.Join(", ", Aliases)}.");
    }
}
