import { NextRequest, NextResponse } from 'next/server';
import { auth } from '@/app/api/auth/[...nextauth]/route';

// Debug endpoint to check session
export async function GET(request: NextRequest) {
  try {
    const session = await auth();
    
    return NextResponse.json({
      hasSession: !!session,
      user: session?.user || null,
      userId: session?.user?.id || null,
      isAdmin: session?.user?.isAdmin || false,
      hasWriteAccess: session?.user?.hasWriteAccess || false,
    }, { status: 200 });
  } catch (error: any) {
    return NextResponse.json(
      { error: 'Failed to get session', details: error.message },
      { status: 500 }
    );
  }
}

