import { DocumentService } from '../../../../../core/backend-api/index.js';
import { tryExecute } from '../../../../../core/resources/index.js';
/**
 * A data source for the Document Culture and Hostnames that fetches data from the server
 * @class UmbDocumentNotificationsServerDataSource
 */
export class UmbDocumentNotificationsServerDataSource {
    #host;
    /**
     * Creates an instance of UmbDocumentNotificationsServerDataSource.
     * @param {UmbControllerHost} host - The controller host for this controller to be appended to
     * @memberof UmbDocumentNotificationsServerDataSource
     */
    constructor(host) {
        this.#host = host;
    }
    /**
     * Fetches the Culture and Hostnames for the given Document unique
     * @param {string} unique - The unique identifier of the Document
     * @memberof UmbDocumentNotificationsServerDataSource
     */
    async read(unique) {
        if (!unique)
            throw new Error('Unique is missing');
        return tryExecute(this.#host, DocumentService.getDocumentByIdNotifications({ path: { id: unique } }));
    }
    /**
     * Updates Culture and Hostnames for the given Document unique
     * @param {string} unique - The unique identifier of the Document
     * @param {UpdateDocumentNotificationsRequestModel} data - The data to update
     * @memberof UmbDocumentNotificationsServerDataSource
     */
    async update(unique, data) {
        if (!unique)
            throw new Error('Unique is missing');
        return tryExecute(this.#host, DocumentService.putDocumentByIdNotifications({ path: { id: unique }, body: data }));
    }
}
