import { useMemo } from 'react' import { useTeamAgents } from './useTeamAgents' import { useAgentProtocol } from './useAgentProtocol' import { useAgentWorkload } from './useAgentWorkload' import { buildAgentPresence } from '../services/agentPresenceService' import type { AgentPresence } from '../domain/agentPresence' /** * Die Belegschaft, wie sie auf der Startseite auftritt (Runde 5). * * Der Hook sammelt Personalblätter, Protokoll und Auslastung ein; was daraus * wird, entscheidet `agentPresenceService` (CLAUDE.md §4.2). */ export function useAgentPresence(): { data: AgentPresence[]; isLoading: boolean } { const { data: agents = [], isLoading: agentsLoading } = useTeamAgents() const { data: protocol = [], isLoading: protocolLoading } = useAgentProtocol() const { data: workload, isLoading: workloadLoading } = useAgentWorkload() const data = useMemo( () => buildAgentPresence({ agents, protocol, workload }), [agents, protocol, workload], ) return { data, isLoading: agentsLoading || protocolLoading || workloadLoading } }