import { getTranslations, setRequestLocale } from 'next-intl/server'
import ContactForm from './ContactForm'
import type { Metadata } from 'next'
import { basicMetadata } from '@/lib/seo'

interface ContactPageProps {
  params: Promise<{ locale: string }>
}

export async function generateMetadata({ params }: ContactPageProps): Promise<Metadata> {
  const { locale } = await params

  const title =
    locale === 'en'
      ? 'Contact — Marmaris Local'
      : locale === 'ru'
        ? 'Контакты — Marmaris Local'
        : 'İletişim — Marmaris Local'

  const description =
    locale === 'en'
      ? 'Get in touch with the Marmaris Local team.'
      : locale === 'ru'
        ? 'Свяжитесь с командой Marmaris Local.'
        : 'Marmaris Local ekibiyle iletişime geçin.'

  return basicMetadata(title, description, locale, '/contact')
}

export default async function ContactPage({ params }: ContactPageProps) {
  const { locale } = await params
  setRequestLocale(locale)

  const t = await getTranslations('forms')
  const navT = await getTranslations('nav')

  return (
    <div className="flex-1 flex flex-col min-h-screen bg-stone text-ink">

      <main className="max-w-xl mx-auto px-4 sm:px-6 lg:px-8 py-12 flex-1 w-full">
        <div className="bg-paper p-8 rounded-3xl border border-pine/8 shadow-sm">
          
          <div className="mb-8 border-b border-dashed border-pine/8 pb-6">
            <h1 className="text-3xl font-heading font-extrabold text-pine lowercase">
              {navT('contact')}
            </h1>
            <p className="text-xs text-shutter font-mono uppercase tracking-wider mt-1.5">
              marmaris local • bize ulaşın
            </p>
          </div>

          <ContactForm
            translations={{
              name: t('name'),
              email: t('email'),
              subject: t('subject'),
              message: t('message'),
              submit: t('submit'),
              sending: t('sending'),
              success: t('contactSuccess')
            }}
          />

        </div>
      </main>
    </div>
  )
}
