import { useEffect, useCallback } from 'react';
import { wsClient } from '../api/websocket';

export function usePlanStatusSync(companyId: string | undefined) {
  const checkAndFixPlanStatus = useCallback(async () => {
    // Server handles plan status sync and pushes updates via WebSocket
  }, []);

  useEffect(() => {
    if (!companyId) return;

    const unsub = wsClient.subscribe('production_plans', () => {
      // Server pushes status corrections; UI will refresh via other hooks
    });

    return unsub;
  }, [companyId]);

  return { checkAndFixPlanStatus };
}
