export class ReadLogsUseCase {
    deps;
    constructor(deps) {
        this.deps = deps;
    }
    execute(input) {
        if (!this.deps.logFileExists()) {
            return { status: 'no-logs' };
        }
        const lines = this.deps.readLastLines(input.lines);
        if (!input.follow) {
            return { status: 'read', lines };
        }
        const onLine = input.onLine ?? (() => { });
        const watcher = this.deps.watchFile(onLine);
        return {
            status: 'following',
            initialLines: lines,
            stop: () => watcher.stop(),
        };
    }
}
//# sourceMappingURL=readLogs.usecase.js.map