/// <reference types="react" />
import { FILE_UPLOAD_STATUS } from './constants';
import { II18nLocaleUpload } from '../i18n';
export interface IUploadFileItem {
    id?: string;
    readonly file?: File;
    name: string;
    type: string;
    status: FILE_UPLOAD_STATUS;
    percent?: number;
}
export interface IImageUploadFileItem extends IUploadFileItem {
    src?: string;
    thumbSrc?: string;
}
export declare type IUploadFileItemInner<UPLOAD_ITEM extends IUploadFileItem> = UPLOAD_ITEM & {
    _id?: string;
    readonly _file?: File;
};
export declare type IUploadOnChangeHandler<Value, UPLOAD_ITEM extends IUploadFileItem> = (value: Value, detail?: IUploadChangeDetail<UPLOAD_ITEM>) => void;
export interface IUploadChangeDetail<UPLOAD_ITEM extends IUploadFileItem> {
    item: IUploadFileItemInner<UPLOAD_ITEM>;
    type: 'change' | 'add' | 'delete' | 'retry';
}
export declare type IUploadOnUploadHandler<ON_UPLOAD_SUCCESS_RETURN = void> = (file: File, report: (percent: number) => void) => Promise<ON_UPLOAD_SUCCESS_RETURN>;
export interface IUploadErrorMessageConfigMap {
    overMaxSize: {
        maxSize: number;
        formattedMaxSize: string;
    };
    overMaxAmount: {
        maxAmount: number;
    };
}
export declare type IUploadOnErrorHandler = <Type extends keyof IUploadErrorMessageConfigMap>(type: Type, data: IUploadErrorMessageConfigMap[Type]) => void;
export declare type IUploadTipConfig<P> = P & {
    formattedMaxSize: string | null;
};
export declare type IUploadTipsFunc<PROPS> = (config: IUploadTipConfig<PROPS>) => React.ReactNode;
export declare type IImageOnUploadSuccessReturn = undefined | null | string | {
    src: string;
    thumbSrc: string;
};
export declare type IImageUploadPreviewHandler = (file: IImageUploadFileItem, fileList: IImageUploadFileItem[]) => void;
export interface IAbstractUploadProps<UPLOAD_ITEM extends IUploadFileItem, ON_UPLOAD_SUCCESS_RETURN, UPLOAD_ITEM_COMP_PROPS extends IUploadItemProps<UPLOAD_ITEM>> {
    className?: string;
    beforeUpload?: (file: File) => boolean | Promise<void>;
    onUpload?: IUploadOnUploadHandler<ON_UPLOAD_SUCCESS_RETURN>;
    onError?: IUploadOnErrorHandler;
    maxSize?: number;
    accept?: string;
    disabled?: boolean;
    manualUpload?: boolean;
    customUploadItem?: React.ComponentType<UPLOAD_ITEM_COMP_PROPS>;
}
export interface IAbstractMultiUploadProps<UPLOAD_ITEM extends IUploadFileItem, ON_UPLOAD_SUCCESS_RETURN, UPLOAD_ITEM_COMP_PROPS extends IUploadItemProps<UPLOAD_ITEM>> extends IAbstractUploadProps<UPLOAD_ITEM, ON_UPLOAD_SUCCESS_RETURN, UPLOAD_ITEM_COMP_PROPS> {
    fileList?: UPLOAD_ITEM[];
    defaultFileList?: UPLOAD_ITEM[];
    onChange: IUploadOnChangeHandler<Array<IUploadFileItemInner<UPLOAD_ITEM>>, UPLOAD_ITEM>;
    multiple?: boolean;
    maxAmount?: number;
    sortable?: boolean;
}
export interface IUploadProps extends IAbstractMultiUploadProps<IUploadFileItem, void, INormalUploadItemProps> {
    tips?: React.ReactNode | IUploadTipsFunc<IUploadProps>;
    pagination?: boolean;
    pageSize?: number;
}
export interface IImageUploadProps extends IAbstractMultiUploadProps<IImageUploadFileItem, IImageOnUploadSuccessReturn, IImageUploadItemProps> {
    tips?: React.ReactNode | IUploadTipsFunc<IImageUploadProps>;
    preview?: IImageUploadPreviewHandler;
    getThumbSrcFromFile: (file: File) => string | Promise<string>;
}
export interface ISingleUploadProps extends IAbstractUploadProps<IUploadFileItem, void, ISingleUploadItemProps> {
    tips?: React.ReactNode | IUploadTipsFunc<ISingleUploadProps>;
    onChange: IUploadOnChangeHandler<IUploadFileItem | null, IUploadFileItem>;
    value?: IUploadFileItem | null;
}
export interface IAbstractUploadTriggerProps<UPLOAD_ITEM extends IUploadFileItem> {
    i18n: II18nLocaleUpload;
    fileList?: UPLOAD_ITEM[];
    disabled?: boolean;
    accept?: string;
    remainAmount?: number;
    maxSize: number;
    maxAmount: number;
    multiple?: boolean;
    onAddFile: (file: File) => Promise<void>;
    onError: IUploadOnErrorHandler;
}
export interface IFileInputProps {
    accept?: string;
    disabled?: boolean;
    remainAmount: number;
    multiple?: boolean;
    onChange: (files: File[]) => void;
}
export interface IAbstractUploadListProps<UPLOAD_ITEM extends IUploadFileItem, UPLOAD_ITEM_COMP_PROPS extends IUploadItemProps<UPLOAD_ITEM>> {
    i18n: II18nLocaleUpload;
    fileList: UPLOAD_ITEM[];
    onRetry: (retryItem: IUploadFileItemInner<UPLOAD_ITEM>) => void;
    onDelete: (retryItem: IUploadFileItemInner<UPLOAD_ITEM>) => void;
    sortable?: boolean;
    onSortChange: (list: Array<IUploadFileItemInner<UPLOAD_ITEM>>) => void;
    customUploadItem?: React.ComponentType<UPLOAD_ITEM_COMP_PROPS>;
}
export interface IUploadListProps extends IAbstractUploadListProps<IUploadFileItem, INormalUploadItemProps> {
    pagination: boolean;
    pageSize: number;
}
export interface IImageUploadListProps extends IAbstractUploadListProps<IImageUploadFileItem, IImageUploadItemProps> {
    trigger: React.ReactNode;
    onPreview: IImageUploadPreviewHandler;
}
export interface IUploadItemProps<UPLOAD_ITEM extends IUploadFileItem> {
    item: IUploadFileItemInner<UPLOAD_ITEM>;
    i18n: II18nLocaleUpload;
    onRetry: IAbstractUploadListProps<UPLOAD_ITEM, any>['onRetry'];
    onDelete: IAbstractUploadListProps<UPLOAD_ITEM, any>['onDelete'];
}
export declare type INormalUploadItemProps = IUploadItemProps<IUploadFileItem>;
export declare type ISingleUploadItemProps = IUploadItemProps<IUploadFileItem>;
export declare type IImageUploadItemProps = IUploadItemProps<IImageUploadFileItem> & {
    onPreview: (file: IImageUploadFileItem) => void;
};
