// app/(app)/devices/[inventoryNumber]/page.tsx
import { redirect } from 'next/navigation';

type RouteParams = { inventoryNumber?: string };

// In Next 15: params ist ein Promise
type PageProps = {
  params: Promise<RouteParams>;
};

export default async function DeviceQrRedirectPage({ params }: PageProps) {
  const { inventoryNumber } = await params;

  if (!inventoryNumber || inventoryNumber === 'undefined') {
    // Fallback: keine gültige ID → Geräteübersicht
    redirect('/devices');
  }

  redirect(`/devices?device=${encodeURIComponent(inventoryNumber)}`);
}
