/**
 * @mergeTarget
 * @module Src/Components/CustomInput/CustomChoice/DyslexiaModeChoiceList
 */

import { LisioComponent, LisioComponentStyles } from "@lisio/lisio-engine";
import { customChoiceStyles } from "./custom-choice.css";

/**
 * List wrapper for {@link DyslexiaModeChoiceItem}. Renders the exact
 * `ul.lisio-custom-choice` markup {@link CustomChoice} renders, so it gets
 * the same CSS for free, without depending on `CustomChoice` itself — which
 * assumes one shared string parameter with several values, not two
 * independent profile/parameter toggles.
 */
class DyslexiaModeChoiceList extends LisioComponent {
  public async render(): Promise<string> {
    return `
      <ul class="lisio-custom-choice ${this.renderClasses()}">
        <children></children>
      </ul>
    `;
  }

  constructor(children: LisioComponent[], cssClasses?: string[]) {
    super(DyslexiaModeChoiceList.name, undefined, cssClasses);
    this._children = children;
  }
}

// Re-registers CustomChoice's own stylesheet under this component's name:
// the engine only inserts a component's CSS into the page once a component
// with that exact name is actually rendered (see css-renderer.js), so
// relying on `CustomChoice` being used *somewhere else* in the same session
// was unreliable — this guarantees the (identical, reused) rules load
// whenever this component does.
new LisioComponentStyles(DyslexiaModeChoiceList.name, customChoiceStyles);

export { DyslexiaModeChoiceList };
