'use client';

/**
 * 점검표 목록/등록 페이지
 */

import { Suspense } from 'react';
import { useSearchParams } from 'next/navigation';
import ChecklistListClient from '@/components/checklist-management/ChecklistListClient';
import { ChecklistDetailClient } from '@/components/checklist-management';
import { ListPageSkeleton } from '@/components/ui/skeleton';

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

  if (mode === 'new') {
    return <ChecklistDetailClient checklistId="new" />;
  }

  return <ChecklistListClient />;
}

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