import DashboardLayout from '@/components/layout/dashboard-layout';
import { DataNav } from '@/components/admin/data-nav';
import { getCurrentLocale, getTranslations } from '@/lib/i18n';

export default async function AccountingLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const locale = await getCurrentLocale();
  const t = getTranslations(locale);
  const tAccounting = t.Accounting ?? {};
  const isRtl = locale === 'ar';

  const navLinks = [
    {
      title: tAccounting?.chartOfAccounts ?? 'شجرة الحسابات',
      href: '/admin/accounting/chart',
    },
    {
      title: tAccounting?.journalEntries ?? 'القيود المحاسبية',
      href: '/admin/accounting/entries',
    },
    {
      title: 'التسوية البنكية',
      href: '/admin/accounting/bank-reconciliation',
    },
    {
      title: 'المصاريف الدورية',
      href: '/admin/accounting/expense-recurring',
    },
  ];

  return (
    <DashboardLayout>
      <div dir={isRtl ? 'rtl' : 'ltr'} className={`grid w-full max-w-[1700px] gap-1 me-auto ms-0 pe-2 sm:pe-4 ${isRtl ? 'text-right' : 'text-left'}`}>
        <div className="w-full border-b mt-2 flex justify-end">
          <DataNav links={navLinks} />
        </div>
        <div className="mt-3">{children}</div>
      </div>
    </DashboardLayout>
  );
}