import { UmbControllerBase } from '../../../../libs/class-api/index.js';
import { DocumentTypeService } from '../../../core/backend-api/index.js';
import { tryExecute } from '../../../core/resources/index.js';
export class UmbDocumentTypeConfigurationServerDataSource extends UmbControllerBase {
    /**
     * Gets the document type configuration from the server.
     * @returns {Promise<UmbDataSourceResponse<UmbDocumentTypeConfigurationModel>>} - The document type configuration.
     * @memberof UmbDocumentTypeConfigurationServerDataSource
     */
    async getConfiguration() {
        const { data, error } = await tryExecute(this, DocumentTypeService.getDocumentTypeConfiguration());
        if (data) {
            const mappedData = {
                dataTypesCanBeChanged: data.dataTypesCanBeChanged === 'True' ? true : false,
                disableTemplates: data.disableTemplates,
                useSegments: data.useSegments,
                reservedFieldNames: data.reservedFieldNames,
            };
            return { data: mappedData };
        }
        return { error };
    }
}
