import { NextRequest, NextResponse } from 'next/server'; import { minecraftApi, PlayerIdentifierInput } from '@/lib/minecraft-api'; export async function POST(request: NextRequest) { try { const body: PlayerIdentifierInput = await request.json(); // Validate input if (!body.type || !body.username) { return NextResponse.json( { error: 'Missing required fields: type and username' }, { status: 400 } ); } if (body.type !== 'java' && body.type !== 'bedrock') { return NextResponse.json( { error: 'Invalid type. Must be "java" or "bedrock"' }, { status: 400 } ); } const result = await minecraftApi.resolvePlayerIdentifier(body); return NextResponse.json({ success: true, data: result }); } catch (error) { console.error('Player resolution error:', error); return NextResponse.json( { success: false, error: error instanceof Error ? error.message : 'Unknown error occurred' }, { status: 500 } ); } }