import { NextResponse } from 'next/server';
import { postgresClient } from '@/lib/services/postgres-client';

export async function GET() {
  try {
    const result = await postgresClient.query(
      `SELECT value, label, is_active FROM company_categories WHERE is_active = true ORDER BY label ASC`
    );
    return NextResponse.json(result.rows);
  } catch (error) {
    console.error('Error fetching company categories:', error);
    return NextResponse.json({ error: 'Failed to fetch company categories' }, { status: 500 });
  }
}
