import type { Metadata } from 'next'
import { getTranslations, setRequestLocale } from 'next-intl/server'

export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
  const { locale } = await params
  const t = await getTranslations({ locale, namespace: 'Misc' })
  return { title: t('maintenance.pageTitle') }
}

/** Mantenimiento — réplica del partial Django `partials/maintenance.html`. */
export default async function MaintenancePage({ params }: { params: Promise<{ locale: string }> }) {
  const { locale } = await params
  setRequestLocale(locale)
  const t = await getTranslations('Misc')

  return (
    <div className="main-page">
      <div className="middle-content">
        <div className="body-content">
          <div className="title-content">
            <h1>{t('maintenance.pageTitle')}</h1>
          </div>
          <div className="box-content">
            <div className="body-box-content centered">
              <p>{t('maintenance.line1')}</p>
              <p>{t('maintenance.line2')}</p>
              <br />
              <p>
                {t.rich('maintenance.discord', {
                  link: (c) => (
                    <a href="https://discord.gg/nightspire" target="_blank" rel="noopener noreferrer">
                      {c}
                    </a>
                  ),
                })}
              </p>
              {/* eslint-disable-next-line @next/next/no-img-element */}
              <img
                src="/nw-themes/nw-ryu/nw-images/nw-general/nightspire-maintenance.webp"
                width={437}
                alt={t('maintenance.pageTitle')}
              />
            </div>
          </div>
        </div>
      </div>
    </div>
  )
}
