#pragma once

#include <string>
#include <unordered_map>
#include <vector>

#include "torlinkc/sources/types.hpp"

namespace torlinkc::ui {

// `sources` maps each result's source id to that Source (see
// sources/registry.hpp's sourceById()) -- sources without swarm data
// (Source::reportsHealth == false) report seeders: 0 for everything
// (unknown, not dead), so hideDead must never drop those rows. Ported from
// ui/filter.ts::filterResults.
std::vector<TorrentResult> filterResults(const std::vector<TorrentResult>& list, bool hideDead,
                                          const std::unordered_map<std::string, Source>& sources,
                                          const std::string& textFilter = "");

}  // namespace torlinkc::ui
