import { ActionHandleStrategyRegistry } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry';
import { AppendChildrenStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/append-children-strategy';
import { BlockDeleteTextOrDecoratorNodeStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-or-decorator-node-strategy';
import { BlockInsertNewParagraphStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy';
import { InsertChildrenAfterStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-children-after-strategy';
import { InsertChildrenBeforeStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-children-before-strategy';
import { InsertNodeToNearestRootStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-node-to-nearest-root-strategy';
import { InsertTextToDecoratorNodeStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-text-to-decorator-node-strategy';
import { ListItemInsertNewParagraphStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy';
import { ListRemoveListItemStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy';
import { PasteContentStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/paste-content-strategy';
import { RemoveChildrenStrategy } from '../../components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/remove-children-strategy';
import { ModifyContentActionType } from '../../components/vega-rich-text-editor/dto/actions/modify-content-action.abstract';
import { RTEListBlock } from '../../components/vega-rich-text-editor/dto/blocks/list-block';
import { RTEListItemBlock } from '../../components/vega-rich-text-editor/dto/blocks/list-item-block';
/**
 * Manager class for registering DTO action strategies.
 */
class RTEDTOActionStrategyManager {
  /**
   * Registers basic strategies for a given DTO class.
   *
   * @param {string} dtoClassName - The name of the RTE block class name.
   */
  registerBlockBasicStrategies(dtoClassName) {
    ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILDREN, dtoClassName, dtoClassName === RTEListBlock.name
      ? new ListRemoveListItemStrategy()
      : new RemoveChildrenStrategy());
    ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILDREN, dtoClassName, new AppendChildrenStrategy());
    ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_CHILDREN_BEFORE, dtoClassName, new InsertChildrenBeforeStrategy());
    ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_CHILDREN_AFTER, dtoClassName, new InsertChildrenAfterStrategy());
    ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_BLOCK_CONTENT, dtoClassName, new BlockDeleteTextOrDecoratorNodeStrategy());
    ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NEW_PARAGRAPH, dtoClassName, dtoClassName === RTEListItemBlock.name
      ? new ListItemInsertNewParagraphStrategy()
      : new BlockInsertNewParagraphStrategy());
    ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_TEXT_TO_DECORATOR_NODE, dtoClassName, new InsertTextToDecoratorNodeStrategy());
    ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODE_TO_NEAREST_ROOT, dtoClassName, new InsertNodeToNearestRootStrategy());
    ActionHandleStrategyRegistry.register(ModifyContentActionType.PASTE_CONTENT, dtoClassName, new PasteContentStrategy());
  }
}
export default new RTEDTOActionStrategyManager();
