'use client';
import { FunctionComponent, PropsWithChildren, useMemo } from 'react';
import { useTranslations } from 'next-intl';
import { ROUTES } from '@/constants';
import { LinkToPage } from '@/utils';
import TopBarAndSideBarLayout from './TopBarAndSideBarLayout';

/**
 * Nurse app shell — the "نمای پرستار" experience (verification, dashboard, EVV visits).
 * Uses the shared TopBar + SideBar engine: a temporary drawer on mobile, persistent on
 * desktop. Nav is role-scoped to the nurse routes.
 * @layout NurseLayout
 */
const NurseLayout: FunctionComponent<PropsWithChildren> = ({ children }) => {
  const t = useTranslations('nav');
  const tShell = useTranslations('shell');

  const sidebarItems: Array<LinkToPage> = useMemo(
    () => [
      { title: t('dashboard'), path: ROUTES.NURSE, icon: 'dashboard' },
      { title: t('profile'), path: ROUTES.NURSE_PROFILE, icon: 'profile' },
      { title: t('coverage'), path: ROUTES.NURSE_COVERAGE, icon: 'coverage' },
      { title: t('bank'), path: ROUTES.NURSE_BANK, icon: 'bank' },
      { title: t('verification'), path: ROUTES.NURSE_VERIFICATION, icon: 'verification' },
      { title: t('visits'), path: ROUTES.NURSE_VISITS, icon: 'visits' },
    ],
    [t]
  );

  return (
    <TopBarAndSideBarLayout
      sidebarItems={sidebarItems}
      title={tShell('nurse_app')}
      variant="sidebarPersistentOnDesktop"
    >
      {children}
    </TopBarAndSideBarLayout>
  );
};

export default NurseLayout;
