import { IEventHub } from '../../events';
import { DownloadChunk } from '../../models';
import { IDownloadChunksRepository } from '../../repositories';
import { ILocker, ILogger } from '../../utilities';
import { DownloadDatabase, IDbDownloadChunk, IDbDownloadFile } from './DownloadDatabase';

export declare function mapDbToDownloadChunk(data: IDbDownloadChunk, file: IDbDownloadFile): DownloadChunk;
export declare function mapDownloadChunkToDb(data: DownloadChunk): IDbDownloadChunk;
export declare class DownloadChunksRepository implements IDownloadChunksRepository {
    private locker;
    private eventHub;
    private logger;
    private db;
    constructor(locker: ILocker, eventHub: IEventHub, logger: ILogger, db: DownloadDatabase);
    /**
     * Get first chunk that is not processed
     *
     * @returns DownloadChunk. NULL if no chunk is not processed.
     */
    getNextUnprocessed(): Promise<DownloadChunk | null>;
    /**
     * Get chunk with specific ID
     *
     * @param id Chunk ID
     * @returns DownloadChunk. NULL if chunk does not exist.
     */
    get(id: string): Promise<DownloadChunk | null>;
    /**
     * Get all chunks in file
     *
     * @param fileID File ID
     * @returns DownloadChunk[]
     */
    getAllInFile(fileID: string): Promise<DownloadChunk[]>;
    /**
     * Save chunk into DB
     *
     * @param chunk DownloadChunk
     * @returns boolean. True if save succeeded. False otherwise
     */
    save(chunk: DownloadChunk): Promise<boolean>;
}
