import { NextRequest, NextResponse } from 'next/server'
import { authenticateH2H, h2hUnauthorized } from '@/lib/h2h-auth'

export const dynamic = 'force-dynamic'

export async function GET(req: NextRequest) {
  const user = await authenticateH2H(req)
  if (!user) return h2hUnauthorized()

  return NextResponse.json({
    success: true,
    data: {
      balance: user.balance,
      currency: 'IDR',
      name: user.name,
      email: user.email,
    },
  })
}
