import { BaseStrategy } from './base-strategy';
/** The VegaRadioChangeStrategy class is responsible for creating an input element for radio buttons and handling the 'change' event. */
export class VegaRadioChangeStrategy extends BaseStrategy {
  constructor() {
    super(...arguments);
    this.eventName = 'change';
    this.vegaComponentName = 'vega-radio';
  }
  /**
   * The function creates and returns a radio input element with the same name as the given delegated target.
   *
   * @param {HTMLElement} delegatedTarget - The delegatedTarget parameter is an
   * HTMLVegaRadioElement, which is a custom element that represents a radio button 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 = 'radio';
    input.checked = delegatedTarget.checked;
    return input;
  }
}
