using ClaudeDo.Data.Filtering;

namespace ClaudeDo.Data.Tests.Filtering;

public sealed class TaskListFilterRegistryTests
{
    private readonly TaskListFilterRegistry _registry = new();

    [Theory]
    [InlineData("smart:my-day",    typeof(SmartFlagFilter))]
    [InlineData("smart:important", typeof(SmartFlagFilter))]
    [InlineData("smart:planned",   typeof(SmartFlagFilter))]
    [InlineData("virtual:queued",  typeof(StatusFilter))]
    [InlineData("virtual:running", typeof(StatusFilter))]
    [InlineData("virtual:review",  typeof(ReviewFilter))]
    public void Resolves_known_built_in_filters(string id, Type expected)
    {
        var f = _registry.Resolve(id);
        Assert.NotNull(f);
        Assert.IsType(expected, f);
        Assert.Equal(id, f!.Id);
    }

    [Fact]
    public void Resolves_user_list_filter_from_prefixed_id()
    {
        var f = _registry.Resolve("user:abc123");
        var user = Assert.IsType<UserListFilter>(f);
        Assert.Equal("user:abc123", user.Id);
    }

    [Fact]
    public void Returns_null_for_unknown_or_empty_user_id()
    {
        Assert.Null(_registry.Resolve("bogus"));
        Assert.Null(_registry.Resolve("user:"));
    }
}
