import { NextRequest, NextResponse } from 'next/server' const SDK_URL = process.env.SDK_URL || 'http://ai-compliance-sdk:8090' export async function GET(request: NextRequest) { try { const tenantId = request.headers.get('x-tenant-id') || '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e' const resp = await fetch(`${SDK_URL}/sdk/v1/ai-registration`, { headers: { 'X-Tenant-ID': tenantId }, }) const data = await resp.json() return NextResponse.json(data) } catch (err) { return NextResponse.json({ error: 'Failed to fetch registrations' }, { status: 500 }) } } export async function POST(request: NextRequest) { try { const tenantId = request.headers.get('x-tenant-id') || '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e' const body = await request.json() const resp = await fetch(`${SDK_URL}/sdk/v1/ai-registration`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Tenant-ID': tenantId }, body: JSON.stringify(body), }) const data = await resp.json() return NextResponse.json(data, { status: resp.status }) } catch (err) { return NextResponse.json({ error: 'Failed to create registration' }, { status: 500 }) } }