export type OutlookAutoLoadView = 'inbox' | 'sent' | 'calendar'; export interface OutlookAutoLoadState { isConfigured: boolean; activeView: OutlookAutoLoadView | 'settings'; loaded: Record; loading: Record; attempted: Record; } export function nextOutlookAutoLoadTarget(state: OutlookAutoLoadState): OutlookAutoLoadView | null { if (!state.isConfigured || state.activeView === 'settings') { return null; } const view = state.activeView; if (state.loaded[view] || state.loading[view] || state.attempted[view]) { return null; } return view; }