"use client";

import React from "react";
import { LayoutWrapper } from "../features/dashboard/layout/layoutWrapper";
import { MainContent } from "../features/dashboard/layout/mainContent";
import SideBar from "../features/dashboard/sidebar/Sidebar";
import Header from "../features/dashboard/header/Header";
import { useTokenExpiration } from "../hooks/useTokenExpiration";
import TokenExpirationInfo from "../components/TokenExpirationInfo";

const DashboardLayout: React.FC<{ children: React.ReactNode }> = ({
  children,
}) => {
  // Monitor token expiration and auto-logout
  useTokenExpiration();

  return (
    <LayoutWrapper>
      <SideBar />
      <div style={{ flexGrow: 1, display: "flex", flexDirection: "column" }}>
        <MainContent>
          <Header />
          <TokenExpirationInfo />
          {children}
        </MainContent>
      </div>
    </LayoutWrapper>
  );
};

export default DashboardLayout;
