'use client';

import { Box } from '@/ui/Box';
import { DashboardRail } from '@/ui/DashboardRail';
import { Text } from '@/ui/Text';
import { usePathname } from 'next/navigation';
import { useCurrentSession } from '@/hooks/auth/useCurrentSession';
import { PublicNav } from '@/components/layout/PublicNav';
import { AuthedNav } from '@/components/layout/AuthedNav';

export interface GlobalSidebarViewData {}

export function GlobalSidebarTemplate(_props: GlobalSidebarViewData) {
  const pathname = usePathname();
  const { data: session } = useCurrentSession();
  const isAuthenticated = !!session;

  return (
    <DashboardRail>
      <Box py={6}>
        <Box px={6} mb={8}>
          <Text size="xs" color="text-gray-500" weight="bold" font="mono" letterSpacing="0.2em">
            NAVIGATION
          </Text>
        </Box>
        <Box px={3}>
          {isAuthenticated ? (
            <AuthedNav pathname={pathname} />
          ) : (
            <PublicNav pathname={pathname} />
          )}
        </Box>
      </Box>
    </DashboardRail>
  );
}
