import { NextResponse } from 'next/server';
import { loadServerBranding } from '@server/branding/loader';
import { wrapRouteHandler } from '@server/logger/request';

async function handleGET() {
  try {
    const { version } = await loadServerBranding();
    return NextResponse.json(
      { version },
      { headers: { 'Cache-Control': 'no-store' } },
    );
  } catch {
    return NextResponse.json({ version: 'default' }, { headers: { 'Cache-Control': 'no-store' } });
  }
}

export const GET = wrapRouteHandler(handleGET);
