import { NextResponse } from 'next/server' import { db } from '@/lib/db' export const dynamic = 'force-dynamic' // GET /api/health — system health check export async function GET() { try { const companyCount = await db.company.count() return NextResponse.json({ status: 'ok', timestamp: new Date().toISOString(), version: '1.0.0', database: { connected: true, companyCount }, uptime: process.uptime ? `${Math.round(process.uptime())}s` : 'n/a', }) } catch { return NextResponse.json({ status: 'error', timestamp: new Date().toISOString(), database: { connected: false }, }, { status: 503 }) } }