import { UmbTemporaryFileServerDataSource } from './temporary-file.server.data-source.js';
import { UmbRepositoryBase } from '../repository/index.js';
/**
 * A repository for uploading temporary files
 * @class UmbTemporaryFileRepository
 * @augments {UmbRepositoryBase}
 */
export class UmbTemporaryFileRepository extends UmbRepositoryBase {
    #source;
    /**
     * Creates an instance of UmbTemporaryFileRepository.
     * @param {UmbControllerHost} host - The controller host for this controller to be appended to
     * @memberof UmbTemporaryFileRepository
     */
    constructor(host) {
        super(host);
        this.#source = new UmbTemporaryFileServerDataSource(host);
    }
    /**
     * Uploads a temporary file
     * @param {string} id
     * @param {File} file
     * @param onProgress
     * @param abortSignal
     * @returns {*}
     * @memberof UmbTemporaryFileRepository
     */
    upload(id, file, onProgress, abortSignal) {
        return this.#source.create(id, file, onProgress, abortSignal);
    }
    /**
     * Deletes a temporary file
     * @param {string} id
     * @returns {*}
     * @memberof UmbTemporaryFileRepository
     */
    delete(id) {
        return this.#source.delete(id);
    }
    /**
     * Gets a temporary file
     * @param {string} id
     * @returns {*}
     * @memberof UmbTemporaryFileRepository
     */
    requestById(id) {
        return this.#source.read(id);
    }
}
