import React from "react"

import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"

import { overview } from "@/constants/routes/myPages"

import { Redirect } from "@/components/Redirect"
import { getIntl } from "@/i18n"

import { SASModal } from "../../components/SASModal"

import type { LangParams, PageArgs } from "@/types/params"

export default async function SASxScandicUnlinkSuccessPage(props: PageArgs<LangParams>) {
  const params = await props.params;
  const intl = await getIntl()

  return (
    <SASModal>
      <Redirect url={overview[params.lang]} timeout={3000} />
      <MaterialIcon
        icon="check_circle"
        size={64}
        color="Icon/Feedback/Success"
      />
      <Typography variant="Title/Subtitle/lg">
        <h1>
          {intl.formatMessage({
            defaultMessage: "Your accounts are now unlinked",
          })}
        </h1>
      </Typography>
      <div>
        <Typography variant="Body/Paragraph/mdRegular">
          <p>
            {intl.formatMessage({
              defaultMessage: "Redirecting you to My Pages.",
            })}
          </p>
        </Typography>
      </div>
    </SASModal>
  )
}
