import { NextResponse } from 'next/server'
import { getSession } from '@/lib/auth'
import { thoughtsVersion } from '@/lib/thoughts-version'

export const runtime = 'nodejs'

// GET /api/thoughts/version — fingerprint for the client-side cache (~100 bytes
// vs the multi-MB full payload).
export async function GET() {
  const session = await getSession()
  if (!session) return NextResponse.json({ error: 'unauthorized' }, { status: 401 })
  return NextResponse.json({ v: await thoughtsVersion() })
}
