import { TorrentMetadataInClient } from "./clients/TorrentClient.js";
import type { Problem } from "./problems.js";
import { MediaType } from "./constants.js";
import { Label } from "./logger.js";
import { Metafile } from "./parseTorrent.js";
import { Result } from "./Result.js";
import { WithRequired, WithUndefined } from "./utils.js";
export interface File {
    name: string;
    path: string;
    length: number;
}
export type SearcheeLabel = Label.SEARCH | Label.RSS | Label.INJECT | Label.ANNOUNCE | Label.WEBHOOK;
export interface Searchee {
    /**
     * If searchee is torrent based, !infoHash && !path for virtual
     */
    infoHash?: string;
    /**
     * If searchee is data based, !infoHash && !path for virtual
     */
    path?: string;
    files: File[];
    /**
     * Original name. Use when interacting with path on disk or client logging
     * e.g. during the action stage for sourceRoot
     */
    name: string;
    /**
     * Usually name but can differ if we can parse something better.
     * e.g. Season 7 -> Show S7
     */
    title: string;
    length: number;
    mtimeMs?: number;
    clientHost?: string;
    savePath?: string;
    category?: string;
    tags?: string[];
    trackers?: string[];
    label?: SearcheeLabel;
}
export type SearcheeWithInfoHash = WithRequired<Searchee, "infoHash">;
export type SearcheeWithoutInfoHash = WithUndefined<Searchee, "infoHash">;
export type SearcheeClient = WithRequired<Searchee, "infoHash" | "clientHost" | "savePath" | "trackers">;
export type SearcheeVirtual = WithUndefined<Searchee, "infoHash" | "path">;
export type SearcheeWithLabel = WithRequired<Searchee, "label">;
export declare function hasInfoHash(searchee: Searchee): searchee is SearcheeWithInfoHash;
export declare enum SearcheeSource {
    CLIENT = "torrentClient",
    TORRENT = "torrentFile",
    DATA = "dataDir",
    VIRTUAL = "virtual"
}
export declare function getSearcheeSource(searchee: Searchee): SearcheeSource;
export declare function getMediaType({ title, files }: Searchee): MediaType;
export declare function getFuzzySizeFactor(searchee: Searchee): number;
export declare function getMinSizeRatio(searchee: Searchee): number;
export declare function getRoot({ path }: File, options?: {
    dirname: (path: string) => string;
    isAbsolute: (path: string) => boolean;
}): Result<string, Error>;
export declare function getRootFolder(file: File): Result<string | null, Error>;
export declare function getLargestFile(files: File[]): File;
export declare function getNewestFileAge(absoluteFilePaths: string[]): Promise<number>;
export declare function getSearcheeNewestFileAge(searchee: SearcheeWithoutInfoHash): Promise<number>;
export declare function getFilesFromDataRoot(rootPath: string, memoizedPaths: Map<string, string[]>, memoizedLengths: Map<string, number>): Promise<File[]>;
/**
 * Parse title from SXX or Season XX. Return null if no title found.
 * Also tries to parse titles that are just `Show`, returns `Show` if better not found.
 * @param name Original name of the searchee/metafile
 * @param files files in the searchee
 * @param path if data based, the path to the searchee
 */
export declare function parseTitle(name: string, files: File[], path?: string): string | null;
export declare function updateSearcheeClientDB(clientHost: string, newSearchees: SearcheeClient[], infoHashes: Set<string>): Promise<void>;
export declare function createSearcheeFromDB(dbTorrent: any): SearcheeClient;
export declare function createSearcheeFromMetafile(meta: Metafile): Result<SearcheeWithInfoHash, Error>;
export declare function createSearcheeFromTorrentFile(filePath: string, torrentInfos: TorrentMetadataInClient[]): Promise<Result<SearcheeWithInfoHash, Error>>;
export declare function createSearcheeFromPath(root: string, memoizedPaths?: Map<string, string[]>, memoizedLengths?: Map<string, number>): Promise<Result<SearcheeWithoutInfoHash, Error>>;
export declare function getAllTitles(titles: string[]): string[];
export declare function getMovieKeys(stem: string): {
    ensembleTitles: string[];
    keyTitles: string[];
    year: number;
} | null;
export declare function getSeasonKeys(stem: string): {
    ensembleTitles: string[];
    keyTitles: string[];
    season: string;
} | null;
export declare function getEpisodeKeys(stem: string): {
    ensembleTitles: string[];
    keyTitles: string[];
    season: string | undefined;
    episode: number | string;
} | null;
export declare function getAnimeKeys(stem: string): {
    ensembleTitles: string[];
    keyTitles: string[];
    release: number;
} | null;
export declare function getReleaseGroup(stem: string): string | null;
export declare function getKeyMetaInfo(stem: string): string;
export declare function createEnsembleSearchees(allSearchees: SearcheeWithLabel[], options: {
    useFilters: boolean;
}): Promise<SearcheeWithLabel[]>;
export declare function collectSearcheeProblems(): Promise<Problem[]>;
