import { notFound } from 'next/navigation'
import { PageView } from '@/components/interactive-page/page-view'
import { validateInteractivePage } from '@/lib/interactive-page'
import thermoFixture from '@/lib/interactive-page/fixtures/thermo-page.json'

/**
 * Dev preview of PageView + thermo fixture (spec §8.3).
 * Only available outside production.
 */
export default function InteractivePagePreviewPage() {
  if (process.env.NODE_ENV === 'production') notFound()

  const parsed = validateInteractivePage(thermoFixture)
  if (!parsed.ok) {
    return (
      <div className="p-8 text-sm text-destructive">
        Fixture invalide : {parsed.issues[0]?.message}
      </div>
    )
  }

  return <PageView page={parsed.page} demoMode="interactive" />
}
