import type { Dispatch, SetStateAction } from 'react';
import type {
  CampusInfo,
  Module,
  ModuleId,
  StaffProfile,
  UserRole,
} from '@/shared/types/app';
import type { TopBarProps } from '@/business/top-bar/types';

export interface UseAppShellOptions {
  readonly profile: StaffProfile | null;
  readonly isMobile: boolean;
}

export interface AppShellState {
  readonly activeModule: ModuleId;
  readonly currentModule: ModuleId;
  readonly userRole: UserRole;
  readonly userName: string;
  readonly userCampus: string;
  readonly campusInfo?: CampusInfo;
  readonly sidebarCollapsed: boolean;
  readonly mobileSidebarOpen: boolean;
  readonly mobileOverlayVisible: boolean;
  readonly zoneCheckIn: string | null;
  readonly sidebarProps: SidebarProps;
  readonly topBarProps: TopBarProps;
  readonly shellOutletContext: ShellOutletContext;
  readonly footerProps: AppFooterProps;
  readonly setSidebarCollapsed: Dispatch<SetStateAction<boolean>>;
  readonly setMobileSidebarOpen: Dispatch<SetStateAction<boolean>>;
  readonly setZoneCheckIn: Dispatch<SetStateAction<string | null>>;
  readonly setCurrentModule: (id: ModuleId) => void;
}

export interface ShellOutletContext {
  readonly userRole: UserRole;
  readonly userName: string;
  readonly userCampus: string;
  readonly zoneCheckIn: string | null;
  readonly setZoneCheckIn: (zone: string | null) => void;
  readonly setCurrentModule: (id: ModuleId) => void;
}

export interface SidebarProps {
  readonly currentModule: ModuleId;
  readonly setCurrentModule: (id: ModuleId) => void;
  readonly userRole: UserRole;
  readonly collapsed: boolean;
  readonly setCollapsed: (value: boolean) => void;
  readonly campusInfo?: CampusInfo;
}

export interface SidebarPage {
  readonly currentModule: ModuleId;
  readonly userRole: UserRole;
  readonly collapsed: boolean;
  readonly campusInfo?: CampusInfo;
  readonly modules: readonly Module[];
  readonly roleLabel: string;
  readonly campusInitial: string | null;
  readonly setCurrentModule: (id: ModuleId) => void;
  readonly toggleCollapsed: () => void;
}

export interface AppFooterProps {
  readonly userName: string;
  readonly userRole: UserRole;
  readonly setCurrentModule: (id: ModuleId) => void;
}
