import { NextRequest, NextResponse } from 'next/server';
import { getPersonajes, getCharacterAssetsMap } from '@/lib/file-service';

export async function GET(
  _request: NextRequest,
  { params }: { params: Promise<{ slug: string }> }
) {
  try {
    const { slug } = await params;
    const personajes = await getPersonajes(slug);
    const assetsMap = await getCharacterAssetsMap(slug, personajes);
    return NextResponse.json(assetsMap);
  } catch (error: any) {
    console.error('Error fetching assets summary:', error);
    return NextResponse.json({ error: error.message }, { status: 500 });
  }
}
