import { getPublishedMarketingBlogPosts } from "@/lib/marketing-blog";
import { getPublicSiteAbsoluteUrl } from "@/lib/mail-urls";
import { buildLlmsFull } from "@/lib/public-discovery";

export const runtime = "nodejs";
export const dynamic = "force-dynamic";

export async function GET() {
  const posts = await getPublishedMarketingBlogPosts().catch(() => []);

  return new Response(buildLlmsFull(posts), {
    headers: {
      "Cache-Control": "public, s-maxage=900, stale-while-revalidate=86400",
      "Content-Language": "ko-KR",
      "Content-Type": "text/markdown; charset=utf-8",
      "Link": `<${getPublicSiteAbsoluteUrl("/llms-full.txt")}>; rel="canonical"`,
    },
  });
}
