import type { INavLink } from "../sidenav-link/webcomponent.type";

export type ThemePreference = "light" | "dark" | "auto";

/** Entry for the sidebar language menu (from `hb-layout` → layouts → sidebar). */
export type I18nLanguageOption = { code: string; label: string };

export type Component = {
  id?: string;
  style?: string;
  navlinks?: INavLink[];
  navpage?: string;
  groups?: { key: string; label: string }[];
  companylogouri?: string;
  companytitle?: string;
  enablefooter?: "yes" | "no" | "false" | null | "" | undefined;
  /** When false or `"no"`, the theme control is hidden. */
  enablethemeswitch?: "yes" | "no" | null | "" | undefined;
  /** Optional controlled value from the host (e.g. after persisting `themeChange`). */
  themepreference?: ThemePreference | null | "" | undefined;
  /** BCP-47 / app language code; should match one of `i18nlanguages[].code` when set. */
  i18nlang?: string | null | "" | undefined;
  /** Available UI languages (JSON string or array). */
  i18nlanguages?: I18nLanguageOption[] | string | null | "" | undefined;
  cookielawallowdecline?: "yes" | "no" | null | "" | undefined;
  cookielawlanguage?: string;
  cookielawuri4more?: string;
  single_screen?: "yes" | "no" | null | "" | undefined;
};

export type Events = {
  pageChange: { page: string };
  /** Host applies Bulma/document hooks (`data-theme` / `theme-*` on `html`/`body`) or ignores. */
  themeChange: { mode: ThemePreference };
  /** Host may update `i18nlang` on `hb-layout` (or equivalent) and reload copy. The sidebar also applies the choice locally (`document.documentElement.lang`, selector state, and host `i18nlang` when the prop was empty). Emitted on mount (effective code) and when the user picks. */
  languageChange: { code: string };
};
