import { FileText, PlusCircle, FolderTree, Settings } from 'lucide-react'
import { SectionCard } from '../components/SectionCard'
import { Breadcrumbs } from '../components/Breadcrumbs'
import { useT } from '../i18n/useT'
import type { BusinessMessageKey } from '../i18n/messages'
import styles from '../components/PageContent.module.css'

const blogSections: {
  icon: typeof FileText
  titleKey: BusinessMessageKey
  descKey: BusinessMessageKey
  linkKey: BusinessMessageKey
  href: string
}[] = [
  {
    icon: FileText,
    titleKey: 'nav.blog.list',
    descKey: 'blog.card.list.desc',
    linkKey: 'blog.card.list.link',
    href: '/blog/list',
  },
  {
    icon: PlusCircle,
    titleKey: 'nav.blog.new',
    descKey: 'blog.card.new.desc',
    linkKey: 'blog.card.new.link',
    href: '/blog/new',
  },
  {
    icon: FolderTree,
    titleKey: 'blog.card.categories.title',
    descKey: 'blog.card.categories.desc',
    linkKey: 'blog.card.categories.link',
    href: '/blog/categories',
  },
  {
    icon: Settings,
    titleKey: 'nav.blog.settings',
    descKey: 'blog.card.settings.desc',
    linkKey: 'blog.card.settings.link',
    href: '/blog/settings',
  },
]

export function BlogPage() {
  const t = useT()

  return (
    <main className={styles.content}>
      <Breadcrumbs
        items={[
          { label: 'Dashboard', href: '/' },
          { label: 'Blog' },
        ]}
      />
      <div className={styles.pageHeader}>
        <div>
          <h2 className={styles.pageTitle}>{t('title.blog')}</h2>
          <p className={styles.pageSubtitle}>{t('blog.page.subtitle')}</p>
        </div>
      </div>

      <div className={styles.gridHome}>
        {blogSections.map((section) => (
          <SectionCard
            key={section.href}
            icon={section.icon}
            title={t(section.titleKey)}
            description={t(section.descKey)}
            linkText={t(section.linkKey)}
            href={section.href}
          />
        ))}
      </div>
    </main>
  )
}
