import { renderToStaticMarkup } from 'react-dom/server';
import { AuthPage, Docs, Landing, type DocTopic } from './Platform';

export const staticRoutes = [
  '/', '/signup', '/login', '/docs', '/docs/install', '/docs/create-project',
  '/docs/specification', '/docs/generate', '/docs/runtime', '/docs/publish',
  '/docs/telemetry', '/download',
] as const;

export function renderRoute(route: string): string {
  if (route === '/') return renderToStaticMarkup(<Landing user={null} />);
  if (route === '/signup') return renderToStaticMarkup(<AuthPage mode="signup" onUser={() => undefined} />);
  if (route === '/login') return renderToStaticMarkup(<AuthPage mode="login" onUser={() => undefined} />);
  const topic = route === '/download' ? 'install' : (route.split('/')[2] || 'overview') as DocTopic;
  return renderToStaticMarkup(<Docs user={null} topic={topic} />);
}
