import { NextResponse } from 'next/server';
import {
  CHARACTER_SPEC_FIELDS,
  FILENAME_SCHEMA,
  PACK_LABELS,
  PACK_ORDER,
  PACK_TEMPLATES,
  TEMPLATE_FREEZE_VERSION,
  TEMPLATE_SLOT_SUMMARY,
  TEXT_TEMPLATES,
  VIDEO_TEMPLATES,
} from '@/lib/templates';

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

export async function GET() {
  return NextResponse.json({
    templateFreezeVersion: TEMPLATE_FREEZE_VERSION,
    filenameSchema: FILENAME_SCHEMA,
    summary: TEMPLATE_SLOT_SUMMARY,
    characterSpecFields: CHARACTER_SPEC_FIELDS,
    packs: PACK_ORDER.map(kind => ({
      kind,
      label: PACK_LABELS[kind],
      templates: PACK_TEMPLATES[kind],
      requiredCount: PACK_TEMPLATES[kind].filter(template => template.required).length,
      totalCount: PACK_TEMPLATES[kind].length,
    })),
    texts: TEXT_TEMPLATES,
    videos: VIDEO_TEMPLATES,
  });
}
