import * as React from "react";
import NewFieldParent from "./NewFieldParent";
import { FormControlLabel } from "@mui/material";
import SelectMask from "../SelectMask";
import CustomizedSwitch from "@ui_kit/CustomSwitch";

interface Props {
  switchState: string;
  closeDrawer: () => void;
}

export default function SwitchNewField({
  switchState = "name",
  closeDrawer,
}: Props) {
  const [SwitchMask, setSwitchMask] = React.useState(false);
  const SwitchMaskHC = (bool: boolean) => {
    setSwitchMask(bool);
  };

  switch (switchState) {
    case "name":
      return (
        <NewFieldParent
          closeDrawer={closeDrawer}
          placeholderHelp={"Введите имя"}
          placeholderField={"Дмитрий"}
          noinputs={true}
          defaultValue={"name"}
        />
      );
    case "email":
      return (
        <NewFieldParent
          closeDrawer={closeDrawer}
          placeholderHelp={"Введите Email"}
          placeholderField={"mail@example.ru"}
          noinputs={true}
          defaultValue={"email"}
        />
      );
    case "phone":
      return (
        <NewFieldParent
          closeDrawer={closeDrawer}
          placeholderHelp={"Введите номер"}
          placeholderField={"+7 900 000 00 00"}
          noinputs={true}
          defaultValue={"phone"}
        >
          {SwitchMask ? <SelectMask /> : <></>}
        </NewFieldParent>
      );
    case "text":
      return (
        <NewFieldParent
          closeDrawer={closeDrawer}
          placeholderHelp={"Введите фамилию"}
          placeholderField={"Иванов"}
          noinputs={false}
          defaultValue={"text"}
        />
      );
    case "address":
      return (
        <NewFieldParent
          closeDrawer={closeDrawer}
          placeholderHelp={"Введите адрес"}
          placeholderField={"Москва, Лаврушинский пер., 10"}
          noinputs={true}
          defaultValue={"address"}
        />
      );
    default:
      return <></>;
  }
}
