import { DictionaryService } from '../../../core/backend-api/index.js';
import { tryExecute } from '../../../core/resources/index.js';
export class UmbDictionaryImportServerDataSource {
    #host;
    constructor(host) {
        this.#host = host;
    }
    /**
     * @description - Import a dictionary
     * @param {string} temporaryFileUnique
     * @param {string?} parentUnique
     * @returns {*}
     * @memberof UmbDictionaryImportServerDataSource
     */
    async import(temporaryFileUnique, parentUnique) {
        if (!temporaryFileUnique)
            throw new Error('temporaryFileUnique is required');
        if (parentUnique === undefined)
            throw new Error('parentUnique is required');
        const body = {
            temporaryFile: { id: temporaryFileUnique },
            parent: parentUnique ? { id: parentUnique } : null,
        };
        return tryExecute(this.#host, DictionaryService.postDictionaryImport({
            body,
        }));
    }
}
