'use client';

/**
 * 공정 목록/등록 페이지
 */

import { Suspense } from 'react';
import { useSearchParams } from 'next/navigation';
import ProcessListClient from '@/components/process-management/ProcessListClient';
import { ProcessDetailClientV2 } from '@/components/process-management';
import { ListPageSkeleton } from '@/components/ui/skeleton';

function ProcessManagementContent() {
  const searchParams = useSearchParams();
  const mode = searchParams.get('mode');

  if (mode === 'new') {
    return <ProcessDetailClientV2 processId="new" />;
  }

  return <ProcessListClient />;
}

export default function ProcessManagementPage() {
  return (
    <Suspense fallback={<ListPageSkeleton showHeader={false} />}>
      <ProcessManagementContent />
    </Suspense>
  );
}
