import { UMB_MEDIA_TYPE_IMPORT_MODAL } from './modal/media-type-import-modal.token.js';
import { UMB_ACTION_EVENT_CONTEXT } from '../../../../core/action/index.js';
import { UmbEntityActionBase, UmbRequestReloadChildrenOfEntityEvent } from '../../../../core/entity-action/index.js';
import { umbOpenModal } from '../../../../core/modal/index.js';
export class UmbImportMediaTypeEntityAction extends UmbEntityActionBase {
    async execute() {
        await umbOpenModal(this, UMB_MEDIA_TYPE_IMPORT_MODAL, {
            data: { unique: this.args.unique },
        }).catch(() => { });
        const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
        if (!actionEventContext) {
            throw new Error('Action event context not found.');
        }
        const event = new UmbRequestReloadChildrenOfEntityEvent({
            unique: this.args.unique,
            entityType: this.args.entityType,
        });
        actionEventContext.dispatchEvent(event);
    }
}
export default UmbImportMediaTypeEntityAction;
