import { DocumentBlueprintService } from '../../../../../core/backend-api/index.js';
import { tryExecute } from '../../../../../core/resources/index.js';
/**
 * Move DocumentBlueprint Server Data Source
 * @class UmbMoveDocumentBlueprintServerDataSource
 */
export class UmbMoveDocumentBlueprintServerDataSource {
    #host;
    /**
     * Creates an instance of UmbMoveDocumentBlueprintServerDataSource.
     * @param {UmbControllerHost} host - The controller host for this controller to be appended to
     * @memberof UmbMoveDocumentBlueprintServerDataSource
     */
    constructor(host) {
        this.#host = host;
    }
    /**
     * Move an item for the given id to the target unique
     * @param {string} unique
     * @param {(string | null)} targetUnique
     * @param args
     * @returns {*}
     * @memberof UmbMoveDocumentBlueprintServerDataSource
     */
    async moveTo(args) {
        if (!args.unique)
            throw new Error('Unique is missing');
        if (args.destination.unique === undefined)
            throw new Error('Destination unique is missing');
        return tryExecute(this.#host, DocumentBlueprintService.putDocumentBlueprintByIdMove({
            path: { id: args.unique },
            body: {
                target: args.destination.unique ? { id: args.destination.unique } : null,
            },
        }));
    }
}
