import * as React from "react";
import { get, startCase, uniqueId } from "lodash";

import { style } from "./style";
import { default as defaultData } from "./data.json";

import { doIShow, combineData, lorem } from "../../utils";
import { IconTypes } from "@sc/plugins/webcomponents/v2/Icon";
import { ImagePlaceholder, ImagePlaceholderTypes } from "../../Placeholders";

import theme from "../../theme";

import {
  Block,
  Section,
  Headline,
  Text,
  Container,
  Button,
  Grid,
  GridItem,
  FormBuilder,
  List,
} from "@sc/plugins/webcomponents/v2";
import { FormFieldTypes } from "@sc/modules/v2/CRUD/FormBuilder/types";

type LayoutProps = {
  data: any;
};

const Layout: React.FC<LayoutProps> = ({ data }) => {
  const initialContent = {
    main_headline: {
      html: "Headline Goes Here",
    },
    sub_headline: {
      html: "Sub Headline Text Content Goes Here",
    },
  };

  const content = combineData(initialContent, defaultData, data);

  return (
    <Block>
      <Section style={style.SECTION}>
        <Container
          style={{
            ...style.SECTION_INNER,
            maxWidth: get(data, "section.pageMargin"),
          }}
        >
          <Grid>
            <GridItem xs={6}>
              <Container style={{ padding: 100 }}>
                <Headline style={style.HEADLINE}>
                  Activate your free account
                </Headline>
                <Text style={style.TEXT}>{lorem.generateSentences(2)}</Text>
                <FormBuilder
                  style={{ marginTop: 10 }}
                  fieldStyle={style.FORM_FIELD.style}
                  inputStyle={style.FORM_FIELD.inputStyle}
                  labelStyle={style.FORM_FIELD.labelStyle}
                  data={[
                    {
                      type: FormFieldTypes.TEXT,
                      name: "firstName",
                      placeholder: "First Name",
                    },
                    {
                      type: FormFieldTypes.TEXT,
                      name: "lastName",
                      placeholder: "Last Name",
                    },
                    {
                      type: FormFieldTypes.TEXT,
                      name: "email",
                      placeholder: "Email",
                    },
                    {
                      type: FormFieldTypes.CHECKBOX,
                      name: "terms",
                      label: "Accept our Terms and Conditions",
                    },
                  ]}
                />
                <Button
                  style={{ ...style.BUTTON.style, marginTop: 30 }}
                  caption1="Next"
                  caption1style={style.BUTTON.caption1}
                />
              </Container>
            </GridItem>
            <GridItem xs={6} style={{ backgroundColor: theme.backgroundColor }}>
              <Container style={{ padding: 100 }}>
                <Headline
                  style={{ ...style.SUBHEADLINE, color: theme.foregroundColor }}
                >
                  What You Will Receive...
                </Headline>

                <List
                  data={[
                    {
                      caption:
                        "<strong>Bonus #1:</strong> " +
                        startCase(lorem.generateWords(6)),
                      style: style.LISTITEM.style,
                      iconStyle: style.LISTITEM.iconStyle,
                      contentStyle: style.LISTITEM.contentStyle,
                      icon: IconTypes.CheckCircleOutline,
                    },
                    {
                      caption:
                        "<strong>Bonus #2:</strong> " +
                        startCase(lorem.generateWords(6)),
                      style: style.LISTITEM.style,
                      iconStyle: style.LISTITEM.iconStyle,
                      contentStyle: style.LISTITEM.contentStyle,
                      icon: IconTypes.CheckCircleOutline,
                    },
                    {
                      caption:
                        "<strong>Bonus #3:</strong> " +
                        startCase(lorem.generateWords(6)),
                      style: style.LISTITEM.style,
                      iconStyle: style.LISTITEM.iconStyle,
                      contentStyle: style.LISTITEM.contentStyle,
                      icon: IconTypes.CheckCircleOutline,
                    },
                    {
                      caption:
                        "<strong>Bonus #4:</strong> " +
                        startCase(lorem.generateWords(6)),
                      style: style.LISTITEM.style,
                      iconStyle: style.LISTITEM.iconStyle,
                      contentStyle: style.LISTITEM.contentStyle,
                      icon: IconTypes.CheckCircleOutline,
                    },
                    {
                      caption:
                        "<strong>Bonus #5:</strong> " +
                        startCase(lorem.generateWords(6)),
                      style: style.LISTITEM.style,
                      iconStyle: style.LISTITEM.iconStyle,
                      contentStyle: style.LISTITEM.contentStyle,
                      icon: IconTypes.CheckCircleOutline,
                    },
                    {
                      caption:
                        "<strong>Bonus #6:</strong> " +
                        startCase(lorem.generateWords(6)),
                      style: style.LISTITEM.style,
                      iconStyle: style.LISTITEM.iconStyle,
                      contentStyle: style.LISTITEM.contentStyle,
                      icon: IconTypes.CheckCircleOutline,
                    },
                  ]}
                />
                <ImagePlaceholder
                  type={ImagePlaceholderTypes.NONE}
                  style={{
                    backgroundColor: theme.foregroundColor,
                    height: 200,
                  }}
                />
              </Container>
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
