/**
 * Manager for registering and retrieving strategies that convert HTML elements to DTOs.
 */
class elementToDTOClassStrategyManager {
  constructor() {
    this.elementToBlockStrategies = [];
    this.elementToNodeStrategies = [];
  }
  /**
   * Registers a element to block strategy for converting HTML elements to DTOs. The new strategy is added to the beginning of the list to give it higher priority.
   *
   * @param {ElementToDTOStrategy} strategy - The strategy to register.
   */
  registerElementToBlockStrategy(strategy) {
    if (!this.hasDuplicateStrategy(strategy, this.elementToBlockStrategies)) {
      this.elementToBlockStrategies.unshift(strategy);
    }
  }
  /**
   * Registers an element to node strategy for converting HTML elements to DTOs. The new strategy is added to the beginning of the list to give it higher priority.
   *
   * @param {ElementToDTOStrategy} strategy - The strategy to register.
   */
  registerElementToNodeStrategy(strategy) {
    if (!this.hasDuplicateStrategy(strategy, this.elementToNodeStrategies)) {
      this.elementToNodeStrategies.unshift(strategy);
    }
  }
  /**
   * Retrieves all registered element to block strategies for converting HTML elements to DTOs.
   *
   * @returns {ElementToDTOStrategy[]} - A set of all registered element to block strategies.
   */
  getElementToBlockStrategies() {
    return this.elementToBlockStrategies;
  }
  /**
   * Retrieves all registered element to node strategies for converting HTML elements to DTOs.
   *
   * @returns {ElementToDTOStrategy[]} - A set of all registered element to node strategies.
   */
  getElementToNodeStrategies() {
    return this.elementToNodeStrategies;
  }
  /**
   * Checks if a strategy is already registered in the provided strategy list.
   *
   * @param {ElementToDTOStrategy} strategy - The strategy to check for duplicates.
   * @param {ElementToDTOStrategy[]} strategyList - The list of strategies to check against.
   * @returns {boolean} - True if the strategy is a duplicate, false otherwise.
   */
  hasDuplicateStrategy(strategy, strategyList) {
    return strategyList.includes(strategy);
  }
}
export default new elementToDTOClassStrategyManager();
