/**
 * @ai-summary Hook for checking vehicle limit and managing limit dialog
 * @ai-context Shared between desktop and mobile vehicle pages
 */

import { useState } from 'react';
import { useTierAccess } from '../../../core/hooks/useTierAccess';

export const useVehicleLimitCheck = (vehicleCount: number) => {
  const { tier, isAtResourceLimit, getResourceLimit } = useTierAccess();
  const [showLimitDialog, setShowLimitDialog] = useState(false);

  const isAtLimit = isAtResourceLimit('vehicles', vehicleCount);
  const limit = getResourceLimit('vehicles');

  return {
    isAtLimit,
    limit,
    tier,
    showLimitDialog,
    setShowLimitDialog,
  };
};
