import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
import { AbstractControl, ControlContainer, ControlValueAccessor, ValidationErrors } from '@angular/forms';
import { BehaviorSubject } from 'rxjs';
import { QdFormControl } from '../reactive-forms/controls/form-control';
import { QdFormFileUploadConfiguration } from '../model/forms.interface';
import { QdFormsActionEmitterService } from '../shared/services/action-emitter.service';
import { QdFileUploadService } from './services/file-upload.service';
import * as i0 from "@angular/core";
/**
 * The **QdFileUpload** component handles file uploads and integrates with forms.
 *
 * ### Features
 * - Upload files with configurable size and type restrictions
 * - Show upload progress and handle errors
 * - Integrate into a reactive form or bind directly to a model
 *
 * ### Usage with Reactive Forms
 *
 * ```ts
 * form = new FormGroup({
 *   file: new FormControl(null, [QdValidators.fileSize(5), QdValidators.fileType(['.jpeg', '.pdf']])
 * });
 * ```
 *
 * ```html
 * <form [formGroup]="form">
 *   <qd-file-upload formControlName="file" [config]="config"></qd-file-upload>
 * </form>
 * ```
 *
 * ### Usage with Model Binding
 *
 * ```ts
 * value: File | null = null;
 * ```
 * ```html
 * <qd-file-upload [(value)]="value" [config]="config"></qd-file-upload>
 * ```
 *
 * ### Upload Manager Integration
 *
 * To connect the component to your backend, implement the `QdFileUploadManager` interface.
 * Provide your own upload manager using Angular’s dependency injection.
 *
 * **Note:** If `QD_UPLOAD_HTTP_OPTIONS` is missing, the FileUpload component will break.
 *
 * ```ts
 * @Injectable()
 * export class MyFileUploadManager implements QdFileUploadManager {
 *   upload(file: File): Observable<HttpEvent<MyUploadResult>> {
 *     const formData = new FormData();
 *     // Add the selected file to the form data
 *     formData.append('file', file);
 *
 *     // Send the form data to your backend with progress tracking enabled
 *     return this.http.post('/my-upload-endpoint', formData, QD_UPLOAD_HTTP_OPTIONS);
 *   }
 * }
 * ```
 *
 * Then register your upload manager in the component provider:
 *
 * ```ts
 * @Component({
 *   ...
 *   providers: [
 *     {
 *       provide: QD_FILE_UPLOAD_MANAGER_TOKEN,
 *       useClass: MyFileUploadManager
 *     }
 *   ]
 * })
 * ```
 *
 * The upload component relies on `HttpEventType.UploadProgress` and `HttpEventType.Response`
 * to show progress and detect when the upload is complete.
 *
 * When the full form is submitted, the file's metadata (such as name, type, and size) is included.
 * This allows the backend to perform cleanup tasks, like removing temporary uploads that were not saved.
 */
export declare class QdFileUploadComponent implements ControlValueAccessor, OnInit, OnDestroy {
    private readonly controlContainer;
    private readonly uploadService;
    private readonly actionEmitterService;
    /**
     * The form control name can be assigned here if you want to use Reactive Forms.
     */
    formControlName?: string;
    /**
     * The configuration for this form item.
     */
    config: QdFormFileUploadConfiguration;
    /**
     * The current form item value, if you are working with Model Binding.
     */
    set value(file: File | null);
    get value(): File | null;
    /**
     * A static test ID for integration tests can be set. <br />
     * The value for the HTML attribute [data-test-id].
     */
    testId: string;
    /**
     * Emits event when the file value has changed. Return value matches the current file.
     */
    valueChange: EventEmitter<File>;
    /**
     * Emits event when a file has been selected.
     */
    fileSelected: EventEmitter<File>;
    /**
     * Emits event when the selected file has been removed.
     */
    fileRemoved: EventEmitter<void>;
    /**
     * Emits event when the hint is clicked/tapped. `hintAction` must be set to `true` for this.
     */
    readonly clickHint: EventEmitter<any>;
    /**
     * Emits event when the readonly value is clicked/tapped. `clickReadonly ` must be set to `true` for this.
     */
    readonly clickReadonly: EventEmitter<any>;
    /**
     * Emits event when the viewonly value is clicked/tapped. `clickViewonly ` must be set to `true` for this.
     */
    readonly clickViewonly: EventEmitter<any>;
    file: File | null;
    uploadProgress$: BehaviorSubject<number>;
    control: AbstractControl | QdFormControl<any> | null;
    private _isDisabled;
    private _value;
    private _state;
    private _uploadSubscription?;
    private _actionSubscriptions;
    private _onChange;
    private _onTouched;
    get isDisabled(): boolean;
    set isDisabled(isDisabled: boolean);
    get isReadonly(): boolean;
    get isViewonly(): boolean;
    get isUploading(): boolean;
    get isUploaded(): boolean;
    get hasError(): boolean;
    get hasValidationError(): boolean;
    get validationErrors(): ValidationErrors | null;
    constructor(controlContainer: ControlContainer, uploadService: QdFileUploadService, actionEmitterService: QdFormsActionEmitterService);
    ngOnInit(): void;
    ngOnDestroy(): void;
    writeValue(file: File | null): void;
    registerOnChange(fn: (_: File | null) => void): void;
    registerOnTouched(fn: () => void): void;
    setDisabledState(isDisabled: boolean): void;
    onFileSelect(event: Event): void;
    startUpload(): void;
    cancelUpload(): void;
    removeFile(): void;
    private handleFileInput;
    private emitFileStateChanges;
    private subscribeToUpload;
    private resetState;
    private clearFile;
    static ɵfac: i0.ɵɵFactoryDeclaration<QdFileUploadComponent, [{ optional: true; host: true; skipSelf: true; }, null, null]>;
    static ɵcmp: i0.ɵɵComponentDeclaration<QdFileUploadComponent, "qd-file-upload", never, { "formControlName": { "alias": "formControlName"; "required": false; }; "config": { "alias": "config"; "required": false; }; "value": { "alias": "value"; "required": false; }; "testId": { "alias": "data-test-id"; "required": false; }; }, { "valueChange": "valueChange"; "fileSelected": "fileSelected"; "fileRemoved": "fileRemoved"; "clickHint": "clickHint"; "clickReadonly": "clickReadonly"; "clickViewonly": "clickViewonly"; }, never, never, false, never>;
}
//# sourceMappingURL=file-upload.component.d.ts.map