import { BaseStrategy } from './base-strategy';
/** The VegaCheckboxChangeStrategy class is responsible for creating an event target and handling the change event for Vega checkboxes. */
export class VegaCheckboxChangeStrategy extends BaseStrategy {
  constructor() {
    super(...arguments);
    this.eventName = 'change';
    this.vegaComponentName = 'vega-checkbox';
  }
  /**
   * The function creates and returns a checkbox input element with the same name as the given delegated target.
   *
   * @param {HTMLElement} delegatedTarget - The delegatedTarget parameter is of type
   * HTMLVegaCheckboxElement, which is a custom element representing a checkbox component in the Vega UI framework.
   * @returns {HTMLInputElement} an HTMLInputElement.
   */
  createEventTarget(delegatedTarget) {
    // eslint-disable-next-line no-restricted-globals
    const input = document.createElement('input');
    this.copyAttributesToTarget(delegatedTarget, input);
    input.type = 'checkbox';
    input.checked = delegatedTarget.checked;
    return input;
  }
}
