import React from "react";
import SidebarOverview from "./SidebarOverview.jsx";
import SidebarAccounts from "./SidebarAccounts.jsx";
import TasksSidebar from "./TasksSidebar.jsx";

export function AppSidebarOverview({
  taskSummary,
  globalStatus,
  selectedTaskName,
  competitorGroups,
  assignedAccountCount,
  taskStatus,
  notificationsOpen,
  setNotificationsOpen,
  infoOpen,
  setInfoOpen,
  bellRef,
  notificationsCount,
  onOpenImport
}) {
  return (
    <>
      <SidebarOverview
        taskSummary={taskSummary}
        globalStatus={globalStatus}
        selectedTaskName={selectedTaskName}
        competitorGroups={competitorGroups}
        assignedAccountCount={assignedAccountCount}
        taskStatus={taskStatus}
        notificationsOpen={notificationsOpen}
        setNotificationsOpen={setNotificationsOpen}
        infoOpen={infoOpen}
        setInfoOpen={setInfoOpen}
        bellRef={bellRef}
        notificationsCount={notificationsCount}
      />
      <SidebarAccounts onOpenImport={onOpenImport} />
    </>
  );
}

export function AppSidebarTasks({
  createTask,
  taskSearch,
  setTaskSearch,
  taskFilter,
  setTaskFilter,
  taskSort,
  setTaskSort,
  filteredTasks,
  taskStatusMap,
  selectedTaskId,
  selectTask,
  deleteTask,
  hasSelectedTask,
  formatCountdown,
  formatTimestamp,
  accountById,
  formatAccountLabel
}) {
  return (
    <TasksSidebar
      createTask={createTask}
      taskSearch={taskSearch}
      setTaskSearch={setTaskSearch}
      taskFilter={taskFilter}
      setTaskFilter={setTaskFilter}
      taskSort={taskSort}
      setTaskSort={setTaskSort}
      filteredTasks={filteredTasks}
      taskStatusMap={taskStatusMap}
      selectedTaskId={selectedTaskId}
      selectTask={selectTask}
      deleteTask={deleteTask}
      hasSelectedTask={hasSelectedTask}
      formatCountdown={formatCountdown}
      formatTimestamp={formatTimestamp}
      accountById={accountById}
      formatAccountLabel={formatAccountLabel}
    />
  );
}

export default function AppSidebar({
  taskSummary,
  globalStatus,
  selectedTaskName,
  competitorGroups,
  assignedAccountCount,
  taskStatus,
  notificationsOpen,
  setNotificationsOpen,
  infoOpen,
  setInfoOpen,
  bellRef,
  notificationsCount,
  onOpenImport,
  createTask,
  taskSearch,
  setTaskSearch,
  taskFilter,
  setTaskFilter,
  taskSort,
  setTaskSort,
  filteredTasks,
  taskStatusMap,
  selectedTaskId,
  selectTask,
  deleteTask,
  hasSelectedTask,
  formatCountdown,
  formatTimestamp,
  accountById,
  formatAccountLabel
}) {
  return (
    <aside className="sidebar left">
      <AppSidebarOverview
        taskSummary={taskSummary}
        globalStatus={globalStatus}
        selectedTaskName={selectedTaskName}
        competitorGroups={competitorGroups}
        assignedAccountCount={assignedAccountCount}
        taskStatus={taskStatus}
        notificationsOpen={notificationsOpen}
        setNotificationsOpen={setNotificationsOpen}
        infoOpen={infoOpen}
        setInfoOpen={setInfoOpen}
        bellRef={bellRef}
        notificationsCount={notificationsCount}
        onOpenImport={onOpenImport}
      />
      <AppSidebarTasks
        createTask={createTask}
        taskSearch={taskSearch}
        setTaskSearch={setTaskSearch}
        taskFilter={taskFilter}
        setTaskFilter={setTaskFilter}
        taskSort={taskSort}
        setTaskSort={setTaskSort}
        filteredTasks={filteredTasks}
        taskStatusMap={taskStatusMap}
        selectedTaskId={selectedTaskId}
        selectTask={selectTask}
        deleteTask={deleteTask}
        hasSelectedTask={hasSelectedTask}
        formatCountdown={formatCountdown}
        formatTimestamp={formatTimestamp}
        accountById={accountById}
        formatAccountLabel={formatAccountLabel}
      />
    </aside>
  );
}
