namespace ClaudeDo.Ui.Services;

public enum InheritSource { Override, List, Global }

public static class InheritanceResolver
{
    // Task-scope fields: task -> list -> global.
    public static (string Value, InheritSource Source) Resolve(
        string? taskValue, string? listValue, string? globalValue)
    {
        if (!string.IsNullOrWhiteSpace(taskValue)) return (taskValue!, InheritSource.Override);
        if (!string.IsNullOrWhiteSpace(listValue)) return (listValue!, InheritSource.List);
        return (globalValue ?? "", InheritSource.Global);
    }

    // List-scope fields: list -> global (lists have no tier above them).
    public static (string Value, InheritSource Source) ResolveList(
        string? listValue, string? globalValue)
    {
        if (!string.IsNullOrWhiteSpace(listValue)) return (listValue!, InheritSource.Override);
        return (globalValue ?? "", InheritSource.Global);
    }
}
