'use client';

/**
 * 출하관리 - 상세 페이지 (Client Component)
 * URL: /outbound/shipments/[id]
 * V2 패턴: ?mode=edit로 수정 모드 전환
 */

import { use } from 'react';
import { useSearchParams } from 'next/navigation';
import { ShipmentDetail, ShipmentEdit } from '@/components/outbound/ShipmentManagement';

interface ShipmentDetailPageProps {
  params: Promise<{ id: string }>;
}

export default function ShipmentDetailPage({ params }: ShipmentDetailPageProps) {
  const { id } = use(params);
  const searchParams = useSearchParams();
  const mode = searchParams.get('mode');
  const isEditMode = mode === 'edit';

  if (isEditMode) {
    return <ShipmentEdit id={id} />;
  }

  return <ShipmentDetail id={id} />;
}