import { login } from "@scandic-hotels/common/constants/routes/handleAuth"
import { signup } from "@scandic-hotels/common/constants/routes/signup"
import { InfoCard } from "@scandic-hotels/design-system/InfoCard"

import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { isLoggedInUser } from "@/utils/isLoggedInUser"

import styles from "./authCard.module.css"

export default async function EmployeeBenefitsAuthCard() {
  const intl = await getIntl()

  const lang = await getLang()

  const isLoggedIn = await isLoggedInUser()

  if (isLoggedIn) {
    return null
  }

  return (
    <InfoCard
      className={styles.card}
      topTitle={intl.formatMessage({
        id: "dtmc.letsBeFriends",
        defaultMessage: "Let’s be friends!",
      })}
      heading={intl.formatMessage({
        id: "dtmc.joinLoyaltyProgram",
        defaultMessage: "Join our loyalty program today!",
      })}
      primaryButton={{
        href: login[lang],
        text: intl.formatMessage({
          id: "dtmc.logIn",
          defaultMessage: "Log in",
        }),
      }}
      secondaryButton={{
        href: signup[lang],
        text: intl.formatMessage({
          id: "common.signUp",
          defaultMessage: "Sign up",
        }),
      }}
      theme="White"
    />
  )
}
