using ClaudeDo.Ui.Services;
using Xunit;

namespace ClaudeDo.Ui.Tests;

public class InheritanceResolverTests
{
    [Fact]
    public void Task_value_is_an_override()
    {
        var (value, source) = InheritanceResolver.Resolve("opus", "sonnet", "haiku");
        Assert.Equal("opus", value);
        Assert.Equal(InheritSource.Override, source);
    }

    [Fact]
    public void Falls_through_to_list()
    {
        var (value, source) = InheritanceResolver.Resolve(null, "sonnet", "haiku");
        Assert.Equal("sonnet", value);
        Assert.Equal(InheritSource.List, source);
    }

    [Fact]
    public void Falls_through_to_global()
    {
        var (value, source) = InheritanceResolver.Resolve("  ", null, "haiku");
        Assert.Equal("haiku", value);
        Assert.Equal(InheritSource.Global, source);
    }

    [Fact]
    public void List_scope_treats_list_value_as_override()
    {
        var (value, source) = InheritanceResolver.ResolveList("sonnet", "haiku");
        Assert.Equal("sonnet", value);
        Assert.Equal(InheritSource.Override, source);

        var (value2, source2) = InheritanceResolver.ResolveList(null, "haiku");
        Assert.Equal("haiku", value2);
        Assert.Equal(InheritSource.Global, source2);
    }
}
