import React from 'react';
import { useSupplyChain } from '../../context/SupplyChainContext';

interface BasePointIconProps {
  className?: string;
  width?: number | string;
  height?: number | string;
}

const BasePointIcon: React.FC<BasePointIconProps> = ({
  className = "",
  width,
  height
}) => {
  const { currentIndustry } = useSupplyChain();

  // 根据产业类型加载对应的SVG文件
  const getIconPath = (industry: string) => {
    const iconMap: Record<string, string> = {
      "粮食": "/supply-chain/BasePointIcon_grain.svg",
      "油脂": "/supply-chain/BasePointIcon_oil.svg",
      "种业": "/supply-chain/BasePointIcon_seed.svg",
      "果蔬": "/supply-chain/BasePointIcon_fruit.svg",
      "畜牧": "/supply-chain/BasePointIcon_livestock.svg",
      "水产": "/supply-chain/BasePointIcon_aquatic.svg",
      "鲜食": "/supply-chain/BasePointIcon_freshfood.svg",
      "泛盐": "/supply-chain/BasePointIcon_salt.svg"
    };
    return iconMap[industry] || "/supply-chain/BasePointIcon_grain.svg";
  };

  const iconPath = getIconPath(currentIndustry);

  return (
    <img
      src={iconPath}
      alt={`${currentIndustry}基地图标`}
      className={className}
      width={width}
      height={height}
    />
  );
};

export default BasePointIcon;
