using ClaudeDo.Data.Models;
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;

namespace ClaudeDo.Data.Filtering.Filters;

public sealed class RunningFilter : ITaskListFilter
{
    public string Id => "virtual:running";
    public bool Matches(TaskEntity t) => t.Status == TaskStatus.Running;
    public bool ShouldCount(TaskEntity t) => t.Status == TaskStatus.Running;
    public bool MatchesAsContext(TaskEntity t, IReadOnlyList<TaskEntity> all) =>
        PlanningRules.IsPlanningParent(t) &&
        PlanningRules.HasMatchingChild(t, all, c => c.Status == TaskStatus.Running);
}
