import { StepConfig } from "@deuna/checkout-core";
import Logout from "components/Logout";
import { Disclaimer } from "components/Disclaimer";
import { Header } from "components/Header";

import { StepName } from "./steps";

interface StepConfigProps {
  handleClose?: () => void;
  onExit?: () => void;
}

const authSteps = ({ handleClose, onExit }: StepConfigProps): StepConfig => ({
  id: "auth",
  views: [],
  mainLayout: [
    {
      name: StepName.AddressStep,
      label: "",
      hiddenStep: true,
      hideMerchantLogo: true,
      sectionOverride: {
        $style: {
          padding: "0px",
        },
      },
      header: [{ pattern: () => <Header handleClose={handleClose} /> }],
      sections: [
        {
          pattern: Disclaimer,
        },
      ],
      footer: [
        {
          pattern: Logout,
          props: {
            onExit: onExit,
            legalMessage: "Acepto todas las ",
          },
        },
      ],
      onValidate: () => {
        return true;
      },
    },
  ],
});

export default authSteps;
