import { getPublicSiteDictionary } from '@/lib/i18n'
import { getPublicSiteLanguage } from '@/lib/i18n.server'
import { DEFAULT_COMPANY_SLUG, siteFetchOrDefault } from '@/lib/api'
import type { PublicSitePageSections } from '@rentaldrivego/types'
import { resolvePageSectionsConfig } from '@/lib/pageSections'

interface BrandResponse {
  brand: {
    menuConfig?: {
      pageSections?: Partial<PublicSitePageSections> | null
    } | null
  } | null
}

export default async function ContactPage() {
  const dict = getPublicSiteDictionary(getPublicSiteLanguage())
  const brand = await siteFetchOrDefault<BrandResponse | null>(`/site/${DEFAULT_COMPANY_SLUG}/brand`, null)
  const pageSections = resolvePageSectionsConfig(brand?.brand?.menuConfig)

  return (
    <main className="min-h-screen bg-slate-50 py-16">
      <div className="shell max-w-2xl">
        {pageSections.contact.content ? <div className="card p-8">
          <h1 className="text-3xl font-black text-slate-900">{dict.contact.title}</h1>
          <p className="mt-3 text-slate-600">{dict.contact.description}</p>
        </div> : null}
      </div>
    </main>
  )
}
