import { Metadata } from 'next';
import { COMPANY_INFO } from '@/lib/constants';
import { getPublishedItems } from '@/lib/cms/data-server';
import type { NewsItem } from '@/lib/constants/news';
import NewsContentV3 from './news-content-v3';

export const metadata: Metadata = {
  title: `新闻动态 - ${COMPANY_INFO.displayName}`,
  description: `了解${COMPANY_INFO.displayName}的最新动态、行业洞察与技术创新。`,
};

// ISR：生产环境每 1 小时自动重新验证，CMS 发布/更新时通过 /api/cms/revalidate 主动刷新
export const revalidate = 3600;

export default async function NewsListPage() {
  const items = await getPublishedItems('news');
  const news = items.map((item) => ({ ...item.data, title: item.data.title || item.title } as unknown as NewsItem));
  return <NewsContentV3 news={news} />;
}