import React from 'react';
import { useServerActions } from '../../../hooks/useServerActions';
import './NoPluginsMessage.css';

export const NoPluginsMessage: React.FC = () => {
  const { serverPath, scanComplete, isScanning } = useServerActions();

  if (isScanning) {
    return (
      <div className="no-plugins-message scanning">
        <div className="spinner"></div>
        <h3>Scanning for plugins...</h3>
        <p>This might take a moment, please wait.</p>
      </div>
    );
  }

  if (!serverPath) {
    return (
      <div className="no-plugins-message no-server">
        <div className="icon">📁</div>
        <h3>No Server Selected</h3>
        <p>Please select a Minecraft server directory to get started.</p>
      </div>
    );
  }

  if (scanComplete && !isScanning) {
    return (
      <div className="no-plugins-message empty">
        <div className="icon">🔍</div>
        <h3>No Plugins Found</h3>
        <p>We couldn't find any plugins in the selected server directory.</p>
        <p className="suggestion">Make sure you've selected a valid Minecraft server with plugins installed.</p>
      </div>
    );
  }

  // Default message if we're in an intermediate state
  return (
    <div className="no-plugins-message">
      <div className="icon">🧩</div>
      <h3>Ready to Scan</h3>
      <p>Click "Scan for Plugins" to discover plugins in your server.</p>
    </div>
  );
};

export default NoPluginsMessage;