'use client';

import { DepositManagement } from '@/components/accounting/DepositManagement';
import DepositDetailClientV2 from '@/components/accounting/DepositManagement/DepositDetailClientV2';
import { getDeposits } from '@/components/accounting/DepositManagement/actions';
import { ListPageSkeleton } from '@/components/ui/skeleton';
import { useAccountingListPage } from '@/hooks';

export default function DepositsPage() {
  const { data, pagination, isLoading, mode } = useAccountingListPage(
    () => getDeposits({ perPage: 100 })
  );

  if (mode === 'new') return <DepositDetailClientV2 initialMode="create" />;
  if (isLoading) return <ListPageSkeleton showStats statsCount={4} tableColumns={7} />;

  return (
    <DepositManagement
      initialData={data}
      initialPagination={pagination}
    />
  );
}