'use client';

import { useParams, useSearchParams } from 'next/navigation';
import { NonconformingDetailView } from '@/components/material/nonconforming/NonconformingDetail';
import { NonconformingForm } from '@/components/material/nonconforming/NonconformingForm';

export default function NonconformingDetailPage() {
  const params = useParams();
  const searchParams = useSearchParams();
  const id = params.id as string;
  const mode = searchParams.get('mode');

  if (mode === 'edit') {
    return <NonconformingForm id={id} mode="edit" />;
  }

  return <NonconformingDetailView id={id} mode="view" />;
}
