import { pageFactory } from "../__factories__/page.factory.js";
import { siteSettingsFactory } from "../__factories__/site-settings.factory.js";
import type { Page } from "../entities/models/page.js";
import type { SiteSettings } from "../entities/models/site-settings.js";

/**
 * Realistic marketing-pages seed for dev mode + storybook stories.
 *
 * Built from `pageFactory` / `siteSettingsFactory` so factory defaults take
 * care of boring fields and we only override what makes the data look like a
 * real site.
 *
 * Lazily produced so importing this module is side-effect-free — the
 * factory's sequence counter only advances when a binder calls
 * `buildDevPages()` / `buildDevSiteSettings()`.
 */
export function buildDevPages(): Page[] {
  const SEED_DATE = new Date("2026-01-01T00:00:00.000Z");
  return [
    pageFactory.build({
      id: "home",
      slug: "home",
      title: "Home",
      hero: { heading: "Welcome to our site" },
      status: "published",
      publishedAt: SEED_DATE,
      seo: { title: "Home | My App" },
    }),
    pageFactory.build({
      id: "about",
      slug: "about",
      title: "About Us",
      hero: { heading: "Our story" },
      status: "published",
      publishedAt: SEED_DATE,
      seo: { title: "About | My App" },
    }),
    pageFactory.build({
      id: "pricing",
      slug: "pricing",
      title: "Pricing",
      hero: { heading: "Simple, transparent pricing" },
      status: "published",
      publishedAt: SEED_DATE,
      seo: { title: "Pricing | My App" },
    }),
  ];
}

export function buildDevSiteSettings(): SiteSettings {
  return siteSettingsFactory.build({
    siteName: "My App",
    siteDescription: "A vertical-feature monorepo template",
  });
}
