import {
  GuaranteedSecurityPayments,
  Header,
  HeaderTimer,
  HiBlock,
  LandingButtonWrapper,
  MoneyBackGuarantee,
  Payments,
  PlanAlsoIncludes,
  RealTimeActivity,
  Reviews,
  SpecialOffer,
  Statistics,
  WhatGet,
} from "@/components/domains/email-marketing/compatibility/v2";
import { loadFunnelPaymentById } from "@/entities/session/funnel/loaders";
import {
  IFunnelPaymentPlacement,
  IFunnelPaymentVariant,
} from "@/entities/session/funnel/types";
import { Currency, ELocalesPlacement } from "@/types";

import styles from "./page.module.scss";

const payload = {
  funnel: ELocalesPlacement.EmailMarketingCompatibilityV2,
};

export default async function EmailMarketingCompatibilityV1Landing() {
  const payment = (await loadFunnelPaymentById(
    payload,
    "main"
  )) as IFunnelPaymentPlacement | null;

  const variant = payment?.variants?.[0];
  const currency = payment?.currency || Currency.USD;
  const oldTrialInterval = 7; // TODO
  const newTrialInterval = payment?.trialInterval || 7;
  const trialPeriod = payment?.trialPeriod || "DAY";

  return (
    <div className={styles.container}>
      <HeaderTimer />
      <Header />
      <HiBlock />
      <WhatGet />
      <SpecialOffer
        variant={variant as IFunnelPaymentVariant}
        currency={currency}
        oldTrialInterval={oldTrialInterval}
        newTrialInterval={newTrialInterval}
        trialPeriod={trialPeriod}
      />
      <PlanAlsoIncludes />
      <Reviews />
      <Statistics />
      <RealTimeActivity />
      <MoneyBackGuarantee />
      <GuaranteedSecurityPayments />
      <Payments />
      <LandingButtonWrapper />
    </div>
  );
}
