/**
 * @mergeTarget
 * @module Src/Screens/More
 */

import {
  LisioCategoryNames,
  LisioProfileNames,
  LisioParameterNames,
} from "@lisio/lisio-profils";
import { LisioScreen } from "../lisio-screen";
import { TextsContainer } from "../../components/containers/texts-container/texts-container";
import { CustomText } from "../../components/custom-text/custom-text";
import { CustomLink } from "../../components/custom-link/custom-link";
import {
  CategoryRenderObject,
  ProfileRenderObject,
  BooleanParameterRenderObject,
  StringParameterRenderObject,
  NumberParameterRenderObject,
  ScreenNames,
} from "../screen-types";
import { ListContainer } from "../../components/containers/list-container/list-container";
import { HomeScreen } from "../home/home-screen";
import { LisioComponent } from "@lisio/lisio-engine";

/**
 * Class representing a more screen component extending LisioScreen.\
 * It aims to represent a more screen component.\
 * A more screen component is basically a component to render all more categories, profiles and parameters.\
 */
class MoreScreen extends LisioScreen {
  /**
   * Protected attribute to store category render objects
   * @source
   */
  protected _categoryRenderObjects: Map<
    LisioCategoryNames,
    CategoryRenderObject
  > = new Map<LisioCategoryNames, CategoryRenderObject>();

  /**
   * Protected attribute to store profile render objects
   * @source
   */
  protected _profileRenderObjects: Map<LisioProfileNames, ProfileRenderObject> =
    new Map<LisioProfileNames, ProfileRenderObject>();

  /**
   * Protected attribute to store parameter render objects
   * @source
   */
  protected _parameterRenderObjects: Map<
    LisioParameterNames,
    | BooleanParameterRenderObject
    | StringParameterRenderObject
    | NumberParameterRenderObject
  > = new Map<
    LisioParameterNames,
    | BooleanParameterRenderObject
    | StringParameterRenderObject
    | NumberParameterRenderObject
  >();

  /**
   * @async
   * Public method implementing abstract method render of LisioComponent
   * @returns Returns a promise containing the representation of a more screen in HTML string
   * @source
   */
  public async render(): Promise<string> {
    return `
        <section id="${this._id}">
            <children></children>
        </section>
        `;
  }

  /**
   * Constructor of class {@link MoreScreen | MoreScreen}
   * @source
   */
  constructor() {
    ScreenNames[MoreScreen.name] = "more-screen";
    super(MoreScreen.name, MoreScreen.name, undefined, HomeScreen.name);
    const elementsTitleContainer: LisioComponent =
      this.createScreenTitle("more-button");

    this._children?.push(
      elementsTitleContainer,
      new ListContainer(
        [
          new CustomText("p", "lisio-company", undefined, [
            "lisio-company",
            "regular",
          ]),
          new CustomLink(
            "https://lisio.fr/contact",
            [
              new TextsContainer(
                [
                  new CustomText("p", "suggest-link", false, [
                    "small",
                    "underline",
                    "center",
                  ]),
                  //new CustomIcon("footer-icons", "NewTab", []),
                ],
                ["more-screen", "new-tab"],
              ),
            ],
            undefined,
            undefined,
            ["secondary", "link-pill", "text-center", "black"],
            "suggest-link-title",
          ),
        ],
        undefined,
        ["column", "secondary", "width-100"],
      ),
    );
  }
}

export { MoreScreen };
