import { FileSystemHandle } from 'native-file-system-adapter';
import { DownloadManagerInvokableFunc, IDownloadManager } from './app/DownloadManager';
import { DownloadContext } from './context';
import { UserPrompt } from './utilities';

export declare enum WorkerRequestType {
    OLWorkerRequestDispatchEvent = "OL_WORKER_REQUEST_DISPATCH_EVENT",
    OLWorkerRequestHandlePermission = "OL_WORKER_REQUEST_HANDLE_PERMISSION",
    OLWorkerRequestHealthCheck = "OL_WORKER_REQUEST_HEALTH_CHECK",
    OLWorkerRequestInit = "OL_WORKER_REQUEST_INIT",
    OLWorkerRequestInvoke = "OL_WORKER_REQUEST_INVOKE",
    OLWorkerRequestLogMessage = "OL_WORKER_REQUEST_LOG_MESSAGE",
    OLWorkerRequestPickDirectory = "OL_WORKER_REQUEST_PICK_DIRECTORY",
    OLWorkerRequestPromptUser = "OL_WORKER_REQUEST_PROMPT_USER",
    OLWorkerRequestReleasePort = "OL_WORKER_REQUEST_RELEASE_PORT",
    OLWorkerRequestTakeLeadership = "OL_WORKER_REQUEST_TAKE_LEADERSHIP"
}
type BaseRequest = {
    id?: string;
};
export type InitRequest = {
    options: DownloaderBuildOptions;
    type: WorkerRequestType.OLWorkerRequestInit;
} & BaseRequest;
type InvokeRequest = {
    arguments: Parameters<IDownloadManager[DownloadManagerInvokableFunc]>;
    function: DownloadManagerInvokableFunc;
    type: WorkerRequestType.OLWorkerRequestInvoke;
} & BaseRequest;
export type DispatchEventRequest = {
    event: any;
    type: WorkerRequestType.OLWorkerRequestDispatchEvent;
} & BaseRequest;
export type PickDirectoryRequest = {
    type: WorkerRequestType.OLWorkerRequestPickDirectory;
} & BaseRequest;
export type HandlePermissionRequest = {
    handle: FileSystemHandle;
    mode: 'read' | 'readwrite';
    type: WorkerRequestType.OLWorkerRequestHandlePermission;
} & BaseRequest;
export type HealthCheckRequest = {
    type: WorkerRequestType.OLWorkerRequestHealthCheck;
} & BaseRequest;
export type TakeLeadershipRequest = {
    type: WorkerRequestType.OLWorkerRequestTakeLeadership;
} & BaseRequest;
export type ReleasePortRequest = {
    type: WorkerRequestType.OLWorkerRequestReleasePort;
} & BaseRequest;
export type PromptUserRequest = {
    prompt: UserPrompt;
    type: WorkerRequestType.OLWorkerRequestPromptUser;
} & BaseRequest;
export type LogMessageRequest = {
    level: 'info' | 'warn' | 'error';
    message: string;
    type: WorkerRequestType.OLWorkerRequestLogMessage;
} & BaseRequest;
export type WorkerRequest = InitRequest | InvokeRequest | DispatchEventRequest | PickDirectoryRequest | HandlePermissionRequest | HealthCheckRequest | TakeLeadershipRequest | ReleasePortRequest | PromptUserRequest | LogMessageRequest;
export type DownloaderBuildOptions = {
    context: DownloadContext;
    defaultMode: 'normal' | 'rocket';
    verboseLogging: boolean;
};
export {};
