import { getStrWithCapitalized } from "@web3r/flowerkit/str";
import type {
  ReactElement, ReactNode, FC, CSSProperties,
} from "react";
import { Fragment, useMemo } from "react";
import { defaultComponents } from "./config";
import type { IComponentBaseProps } from "../../types/components";
import { useCN } from "../../utils/react/useCN";
import { Btn } from "../btn";
import { Checker } from "../checker";
import { FormatText } from "../formatText";
import { Grid, GridItem } from "../grid";
import { Input } from "../input";
import { Label } from "../label";
import { Palette } from "../palette";
import { Section } from "../section";
import "./style.pcss";


type TComponentsGroups = "text" | "images" | "quotes" | "lists" | "tables" | "headings" | "buttons" | "inputs" | "checkers" | "palette";

type TComponentsProps = Partial<{
  getWithDecorator: (content: ReactElement) => ReactElement;
  children: ReactNode;
}> | null;

type TComponents = Partial<{
  palette: TComponentsProps;
  text: TComponentsProps;
  images: TComponentsProps;
  quotes: TComponentsProps;
  lists: TComponentsProps;
  tables: TComponentsProps;
  headings: TComponentsProps;
  buttons: TComponentsProps;
  inputs: TComponentsProps;
  checkers: TComponentsProps;
}>;


interface ITypo {
  /**
   * выводимые блоки
   */
  components?: TComponents | null;
  /**
   * флаг форматирования текста в виде установки неразрывных пробелов и преобразования тире
   */
  isFormatText?: boolean;
  /**
   * флаг форматирования текста в виде нормализации стилей сторонних от тегов
   */
  isForceStyles?: boolean;
}

const PlaceholderImage = ({ width, height, style }: Partial<{ width: number; height: number; style: CSSProperties; }>): ReactElement => {
  return <img style={style} width={width} height={height} alt={""} src={"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtAAAAHgCAMAAAC7G6qeAAAAOVBMVEXx8/XCy9Lw8vTs7/HFztTK0tjEzNPY3uPj5+vu8fPm6u3V2+DHz9bg5OjP1tzp7fDc4ebR2N7M1NpbyZWLAAAN/ElEQVR42uzSAQ0AAAzDoN+/6floQAP3ECI0KUKTIjQpQpMiNClCkyI0KUKTIjQpQpMiNClCkyI0KUKTIjQpQpMiNClCkyI0KUKTIjQpQpMiNClCkyI0KUKTIjQpQpMiNClCkyI0KUKTIjQp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0C+LnP+zbSw7CIBSG0QQLtEVacP+LdepA42ME5pw1kJsvfwIDCm35KZ+zeYMhhRp/yQ35zKi+HjuWIjcY2Jcfs2K1PjO0S16cZ/7IxyGdDvXMDPaePnjON7XBJLYW38XGUW11zONst9cpna59dZ2Zy7aWmJ4f53ZqZ+YTLms+4pIe3vI1lrprDaYVzr22XHrvpeS27kqD+YUQti3IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAe3twSAAAAAAg6P9rbxgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmApYPs+mh6X0DQAAAABJRU5ErkJggg=="} />;
};

const PlaceholderTitle = (): ReactNode => {
  return "Lorem Ipsum is simply dummy text";
};

const PlaceholderText = ({ isShort = false }: { isShort?: boolean; }): ReactNode => {
  const intro = "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.";
  return isShort ? intro : `${intro} If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.`;
};

const TypoContent = ({ group }: { group: TComponentsGroups; }): ReactNode => {
  switch (group) {
    case "palette":
      return <Palette items={[]} />;
    case "headings":
      return (
        <FormatText>
          <h2 className={"h1"}>H1: <PlaceholderTitle /> of the printing and typesetting industry.</h2>
          <h2>H2: <PlaceholderTitle /> of the printing and typesetting industry.</h2>
          <h3>H3: <PlaceholderTitle /> of the printing and typesetting industry.</h3>
          <h4>H4: <PlaceholderTitle /> of the printing and typesetting industry.</h4>
          <h5>H5: <PlaceholderTitle /> of the printing and typesetting industry.</h5>
          <h6>H6: <PlaceholderTitle /> of the printing and typesetting industry.</h6>
        </FormatText>
      );
    case "text":
      return (
        <FormatText>
          <p>
            <b>Lorem Ipsum</b> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make <a href={"#"} rel={"noreferrer"} target={"_blank"}>a type specimen book</a>. It has survived not only <strong>five centuries</strong>, but also the leap into electronic typesetting, <s>remaining essentially unchanged</s>. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently <u>with desktop publishing</u> software like Aldus<sup>PageMaker</sup> including versions <sub>of Lorem Ipsum</sub>.
          </p>
          <p>
            <i>Contrary to popular belief</i>, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a <mark>Latin professor</mark> at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through <a href={"#"}>the cites of the word</a> in classical literature, discovered <code>the undoubtable source</code>. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This <kbd>book</kbd> is a treatise on the theory of ethics, very popular during the Renaissance. <ins>The first line of Lorem Ipsum</ins>, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
          </p>
          <hr />
          <pre>
            <PlaceholderText />
          </pre>
          <hr />
          <small>
            <PlaceholderText />
          </small>
        </FormatText>
      );
    case "lists":
      return (
        <FormatText>
          <h3 className={"h4"}>UL</h3>
          <ul>
            <li><PlaceholderText isShort={true} /></li>
            <li><PlaceholderText isShort={true} /></li>
            <li><PlaceholderText isShort={true} /></li>
          </ul>
          <h3 className={"h4"}>OL</h3>
          <ol>
            <li><PlaceholderText isShort={true} /></li>
            <li><PlaceholderText isShort={true} /></li>
            <li><PlaceholderText isShort={true} /></li>
          </ol>
          <h3 className={"h4"}>UL nested</h3>
          <ul>
            <li>
              <PlaceholderText isShort={true} />
            </li>
            <li>
              <PlaceholderText isShort={true} />
              <ol>
                <li><PlaceholderText isShort={true} /></li>
                <li>
                  <PlaceholderText isShort={true} />
                  <ul>
                    <li><PlaceholderText isShort={true} /></li>
                    <li><PlaceholderText isShort={true} /></li>
                  </ul>
                </li>
              </ol>
            </li>
            <li>
              <PlaceholderText isShort={true} />
            </li>
            <li>
              <PlaceholderText isShort={true} />
            </li>
          </ul>
          <h3 className={"h4"}>OL nested</h3>
          <ol>
            <li><PlaceholderText isShort={true} /></li>
            <li>
              <PlaceholderText isShort={true} />
              <ol>
                <li><PlaceholderText isShort={true} /></li>
                <li>
                  <PlaceholderText isShort={true} />
                  <ul>
                    <li><PlaceholderText isShort={true} /></li>
                    <li><PlaceholderText isShort={true} /></li>
                    <li>
                      <PlaceholderText isShort={true} />
                      <ol>
                        <li><PlaceholderText isShort={true} /></li>
                        <li><PlaceholderText isShort={true} /></li>
                      </ol>
                    </li>
                  </ul>
                </li>
                <li><PlaceholderText isShort={true} /></li>
              </ol>
            </li>
            <li><PlaceholderText isShort={true} /></li>
          </ol>
        </FormatText>
      );
    case "quotes":
      return (
        <FormatText>
          <blockquote>
            <p><PlaceholderText /></p>
            <p><PlaceholderText /></p>
            <cite>
              Lorem Ipsum
            </cite>
          </blockquote>
          <q><PlaceholderText isShort={true} /></q>
        </FormatText>
      );
    case "images":
      return (
        <FormatText>
          <PlaceholderImage width={620} height={480} style={{ float: "left" }} />
          <p><PlaceholderText /></p>
          <PlaceholderImage width={480} height={320} style={{ float: "right" }} />
          <p><PlaceholderText /></p>
          <p><PlaceholderText /></p>
          <PlaceholderImage width={480} height={300} />
          <p><PlaceholderText /></p>
        </FormatText>
      );
    case "tables":
      return (
        <FormatText>
          <table>
            <thead>
              <tr>
                <th>
                  <PlaceholderTitle />
                </th>
                <th>
                  Lorem Ipsum
                </th>
                <th>
                  <PlaceholderTitle />
                </th>
                <th>
                  Lorem Ipsum
                </th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td><PlaceholderText isShort={true} /></td>
                <td><PlaceholderText isShort={true} /></td>
                <td><PlaceholderText isShort={true} /></td>
                <td><PlaceholderText isShort={true} /></td>
              </tr>
            </tbody>
          </table>
        </FormatText>
      );
    case "buttons": {
      const buttons = [
        "default",
        "light",
        "outline",
      ];
      const states = [
        "default",
        "hover",
        "active",
        "disabled",
      ];
      return (
        buttons.map((type, index) => {
          return (
            <Fragment key={type}>
              <Grid columns={[ 4, 2, 1 ]}>
                {states.map((state) => {
                  const id = "btn" + type + getStrWithCapitalized(state);
                  const props = {
                    id,
                    label: `Button`,
                    isOutline: type === "outline",
                    isLight: type === "light",
                    isDisabled: state === "disabled",
                    extraClasses: {
                      isHover: state === "hover",
                      isActive: state === "active",
                    },
                  };
                  return (
                    <GridItem key={id}>
                      <Label htmlFor={id} label={`${type} / ${state}`} />
                      <Btn {...props} />
                    </GridItem>
                  );
                })}
              </Grid>
              {index + 1 !== buttons.length && <hr />}
            </Fragment>
          );
        })
      );
    }
    case "inputs": {
      const inputs = [
        "text",
        "textarea",
      ] as const;
      const states = [
        "default",
        "hover",
        "focus",
        "disabled",
        "readonly",
        "invalid",
        "valid",
      ];
      return inputs.map((type, index) => {
        return (
          <Fragment key={type}>
            <Grid columns={1}>
              {states.map((state) => {
                const id = "input" + getStrWithCapitalized(type) + getStrWithCapitalized(state);
                const props = {
                  id,
                  type,
                  isRequired: state === "valid" || state === "invalid",
                  isReadOnly: state === "readonly",
                  isDisabled: state === "disabled",
                  extraClasses: {
                    isInvalid: state === "invalid",
                    isValid: state === "valid",
                    isHover: state === "hover",
                    isFocus: state === "focus",
                  },
                };
                return (
                  <GridItem key={id}>
                    <Label htmlFor={id} label={`${type} / ${state}`} />
                    <Input {...props} />
                  </GridItem>
                );
              })}
            </Grid>
            {index + 1 !== inputs.length && <hr />}
          </Fragment>
        );
      });
    }
    case "checkers": {
      const checkers = [
        "checkbox",
        "radio",
      ] as const;
      const states = [
        "default",
        "checked",
        "hover",
        "focus",
        "disabled",
        "invalid",
        "valid",
      ];
      return checkers.map((type, index) => {
        return (
          <Fragment key={type}>
            <Grid columns={1}>
              {states.map((state) => {
                const id = "input" + getStrWithCapitalized(type) + getStrWithCapitalized(state);
                const props = {
                  id,
                  type,
                  isRequired: state === "valid" || state === "invalid",
                  isChecked: state === "checked",
                  isDisabled: state === "disabled",
                  extraClasses: {
                    isInvalid: state === "invalid",
                    isValid: state === "valid",
                    isHover: state === "hover",
                    isFocus: state === "focus",
                  },
                };
                return (
                  <GridItem key={id}>
                    <Checker label={`${type} / ${state}`} {...props} />
                  </GridItem>
                );
              })}
            </Grid>
            {index + 1 !== checkers.length && <hr />}
          </Fragment>
        );
      });
    }
    default:
      return null;
  }
};

const TypoBlock = ({ group, children, getWithDecorator }: { group: TComponentsGroups; } & TComponentsProps): ReactNode => {
  if (children) {
    return <FormatText>{children}</FormatText>;
  } else {
    const component = <TypoContent group={group} />;
    return typeof getWithDecorator === "function" ? getWithDecorator(component) : component;
  }
};

const TypoDefaults = ({ components = {} }: { components: TComponents; }) => {
  return Object.entries(components)
    .filter(([ group, options ]) => !!options)
    .map(([ group, options ]) => {
      const title = getStrWithCapitalized(group);
      const { children, getWithDecorator } = options || {};
      return (
        <Section key={group} id={`typo${title}`} slotHeader={<h2 className={"h3"}>{title}</h2>}>
          <TypoBlock group={group as TComponentsGroups} getWithDecorator={getWithDecorator}>
            {children}
          </TypoBlock>
        </Section>
      );
    });
};

/**
 * Компонент типографики. Используется для вывода всех возможных элементов визуального редактора и общих UI
 * @returns {ReactElement}
 */
const Typo: FC<ITypo & IComponentBaseProps> = ({
  baseClass = "typo",
  extraAttrs = {},
  extraClasses = {},
  style = {},
  components = defaultComponents,
  isForceStyles = true,
  isFormatText = true,
  children,
}): ReactElement => {

  const { getCN } = useCN(baseClass);

  const computedComponents = useMemo<TComponents>(() => {
    return {
      ...defaultComponents,
      ...components,
    };
  }, [ components ]);

  return (
    <div className={getCN("", { isForceStyles, ...extraClasses })} style={style} {...extraAttrs}>
      {!!components && <TypoDefaults components={computedComponents} />}
      {(!!children && isFormatText) ? <FormatText>{children}</FormatText> : children}
    </div>
  );

};

export type { ITypo };

export {
  Typo,
};
