import { WaterFertilizerManagement } from '../irrigation/WaterFertilizerManagement';
import { SmartIrrigation } from '../irrigation/SmartIrrigation';
import { FertilizerFormula } from '../irrigation/FertilizerFormula';
import { WaterFertilizerControl } from '../irrigation/WaterFertilizerControl';
import { MonitoringAlert } from '../irrigation/MonitoringAlert';
import { IrrigationModelConfig } from '../irrigation/IrrigationModelConfig';

interface IrrigationControlProps {
  activePath?: string;
}

export function IrrigationControl({ activePath }: IrrigationControlProps) {
  const renderContent = () => {
    switch (activePath) {
      // 水肥机管理
      case '/irrigation/wf-management/device':
      case '/irrigation/wf-management/component':
      case '/irrigation/wf-management/parameter':
      case '/irrigation/wf-management/mapping':
        return <WaterFertilizerManagement activePath={activePath} />;
      // 智能灌溉
      case '/irrigation/smart/model-config':
        return <IrrigationModelConfig />;
      case '/irrigation/smart/auto':
      case '/irrigation/smart/manual':
      case '/irrigation/smart/realtime':
      case '/irrigation/smart/history':
        return <SmartIrrigation activePath={activePath} />;
      // 施肥配方管理
      case '/irrigation/fertilizer/water-control':
      case '/irrigation/fertilizer/level-setting':
      case '/irrigation/fertilizer/stirring-control':
      case '/irrigation/fertilizer/history-data':
        return <FertilizerFormula activePath={activePath} />;
      // 水肥控制
      case '/irrigation/wf-control/params':
      case '/irrigation/wf-control/tank-realtime':
      case '/irrigation/wf-control/valve-control':
      case '/irrigation/wf-control/valve-realtime':
      case '/irrigation/wf-control/fertilizer-history':
      case '/irrigation/wf-control/valve-history':
        return <WaterFertilizerControl activePath={activePath} />;
      // 实时监测与预警
      case '/irrigation/monitoring/alert-logic':
      case '/irrigation/monitoring/threshold-alert':
      case '/irrigation/monitoring/notification-push':
        return <MonitoringAlert activePath={activePath} />;
      default:
        return <WaterFertilizerManagement activePath={activePath} />;
    }
  };

  return renderContent();
}
