'use client';

import { Suspense } from 'react';
import { useSearchParams } from 'next/navigation';
import PricingTableListClient from '@/components/pricing-table-management/PricingTableListClient';
import { PricingTableDetailClient } from '@/components/pricing-table-management';
import { ListPageSkeleton } from '@/components/ui/skeleton';

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

  if (mode === 'new') {
    return <PricingTableDetailClient pricingTableId="new" />;
  }

  return <PricingTableListClient />;
}

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