import type { Stats } from 'node:fs'; import type { AppConfig, MediaTypeConfig } from '../models/config.js'; import type { FileOperation, FileTimes } from '../models/fileOperation.js'; /** * A per-run cache that maps a date-path key to the chosen import letter. * Key format: `///
` * * This ensures all files with the same media type and capture date that are * processed in a single archiver run land in the same letter subdirectory. * The next run will find that letter already on disk and pick the next one. */ export type LetterCache = Map; /** * Creates a fresh, empty LetterCache. One instance should be created per * archiver run and passed down to every `resolveNewDestination` call. */ export declare function createLetterCache(): LetterCache; /** * Finds the media type configuration that matches a given file extension. * Returns undefined if no type matches (file will be skipped). */ export declare function resolveMediaType(ext: string, config: AppConfig): MediaTypeConfig | undefined; /** * Extracts FileTimes from a file's Stats. * atime and mtime are intentionally set to the same value (atime) * so that archiving preserves the original capture date. */ export declare function buildFileTimes(stats: Stats): FileTimes; /** * For `copy` and `move` modes: computes the destination path under * `baseDestPath/YYYY/MM/DD//filename`. * * The letter is determined once per `(baseDestPath, date)` combination per run: * - On first encounter, the next available letter is found on disk and cached. * - On subsequent encounters for the same key, the cached letter is reused, * so all files of the same type and date in a single run share one folder. * * @throws If all 26 letters are already taken. */ export declare function resolveNewDestination(baseDestPath: string, fileName: string, stats: Stats, letterCache: LetterCache): string; /** * For `date` mode: searches for an existing file by name and size within * `baseDestPath/YYYY/MM/DD/`. Returns the full path if found, undefined otherwise. */ export declare function findExistingDestination(baseDestPath: string, fileName: string, stats: Stats): string | undefined; /** * Builds a FileOperation for a given source file. * * Returns undefined if: * - The file extension is not matched by any configured media type. * - Mode is `date` and no existing destination file is found (caller receives a warning). */ export declare function buildFileOperation(filePath: string, stats: Stats, config: AppConfig, targetDir: string, mode: 'copy' | 'move' | 'date', letterCache: LetterCache, onDateModeNotFound?: (src: string) => void): FileOperation | undefined;