import { UMB_PROPERTY_EDITOR_DATA_SOURCE_ITEM_REPOSITORY_ALIAS } from '../item/constants.js';
import { UMB_PROPERTY_EDITOR_DATA_SOURCE_COLLECTION_MENU_ALIAS } from '../collection/constants.js';
import { UMB_PROPERTY_EDITOR_DATA_SOURCE_SEARCH_PROVIDER_ALIAS } from '../search/constants.js';
import { UmbPickerInputContext } from '../../picker-input/index.js';
import { UmbModalToken } from '../../modal/index.js';
import { UMB_COLLECTION_ITEM_PICKER_MODAL_ALIAS, } from '../../collection/index.js';
const modalToken = new UmbModalToken(UMB_COLLECTION_ITEM_PICKER_MODAL_ALIAS, {
    modal: {
        type: 'sidebar',
        size: 'small',
    },
});
export class UmbPropertyEditorDataSourcePickerInputContext extends UmbPickerInputContext {
    constructor(host) {
        super(host, UMB_PROPERTY_EDITOR_DATA_SOURCE_ITEM_REPOSITORY_ALIAS, modalToken);
    }
    #dataSourceTypes = [];
    setDataSourceTypes(value) {
        this.#dataSourceTypes = value;
    }
    getDataSourceTypes() {
        return this.#dataSourceTypes;
    }
    async openPicker(pickerData) {
        const combinedPickerData = {
            ...pickerData,
            collection: {
                menuAlias: UMB_PROPERTY_EDITOR_DATA_SOURCE_COLLECTION_MENU_ALIAS,
                filterArgs: {
                    dataSourceTypes: this.getDataSourceTypes(),
                    ...pickerData?.collection?.filterArgs,
                },
            },
            search: {
                providerAlias: UMB_PROPERTY_EDITOR_DATA_SOURCE_SEARCH_PROVIDER_ALIAS,
                queryParams: {
                    dataSourceTypes: this.getDataSourceTypes(),
                    ...pickerData?.search?.queryParams,
                },
            },
        };
        await super.openPicker(combinedPickerData);
    }
}
