import Link from 'next/link';
import type { SiteConfig } from '@/lib/types';

export function Footer({ config }: { config: SiteConfig | null }) {
  const year = new Date().getFullYear();
  return (
    <footer className="bg-[#070a1f] text-slate-400">
      <div className="container-page grid grid-cols-1 gap-8 py-12 md:grid-cols-4">
        <div>
          <h3 className="mb-3 text-base font-semibold text-white">
            {config?.siteName ?? '智管物业'}
          </h3>
          <p className="text-sm leading-7 text-gray-400">
            专业物业管理系统提供商，让物业管理像发微信一样简单。提供物业缴费、在线报修、社区公告、设备巡检等一站式SaaS解决方案。
          </p>
        </div>
        <div>
          <h4 className="mb-3 text-sm font-semibold text-white">产品方案</h4>
          <ul className="space-y-2 text-sm text-gray-400">
            <li><Link href="/products" className="hover:text-brand-300">物业缴费系统</Link></li>
            <li><Link href="/products" className="hover:text-brand-300">在线报修</Link></li>
            <li><Link href="/products" className="hover:text-brand-300">社区公告</Link></li>
            <li><Link href="/products" className="hover:text-brand-300">业主服务小程序</Link></li>
          </ul>
        </div>
        <div>
          <h4 className="mb-3 text-sm font-semibold text-white">快速导航</h4>
          <ul className="space-y-2 text-sm text-gray-400">
            <li><Link href="/" className="hover:text-brand-300">首页</Link></li>
            <li><Link href="/products" className="hover:text-brand-300">产品方案</Link></li>
            <li><Link href="/news" className="hover:text-brand-300">新闻资讯</Link></li>
            <li><Link href="/about" className="hover:text-brand-300">关于我们</Link></li>
            <li><Link href="/contact" className="hover:text-brand-300">联系我们</Link></li>
          </ul>
        </div>
        <div>
          <h4 className="mb-3 text-sm font-semibold text-white">联系方式</h4>
          <ul className="space-y-2 text-sm text-gray-400">
            {config?.tel && <li>电话：{config.tel}</li>}
            {config?.email && <li>邮箱：{config.email}</li>}
            {config?.address && <li>地址：{config.address}</li>}
          </ul>
        </div>
      </div>
      <div className="border-t border-white/[0.06] py-4">
        <div className="container-page flex flex-col items-center justify-between gap-2 text-xs text-gray-500 sm:flex-row">
          <p>{config?.copyright || `© ${year} ${config?.siteName ?? '智管物业'} 版权所有`}</p>
          {config?.icp && <p>{config.icp}</p>}
        </div>
      </div>
    </footer>
  );
}
