import React from 'react'

interface StationIconProps {
  type: string
  size?: number
}

export function StationIcon({ type, size = 24 }: StationIconProps) {
  const s = size
  const sw = 1.5

  switch (type) {
    case 'press':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Ram pressing down */}
          <rect x="7" y="2" width="10" height="4" rx="1" />
          <line x1="12" y1="6" x2="12" y2="12" />
          <path d="M6 12h12v3H6z" />
          <line x1="12" y1="12" x2="12" y2="10" strokeWidth={2.5} />
          {/* Base block */}
          <rect x="5" y="18" width="14" height="4" rx="1" />
          {/* Workpiece */}
          <rect x="9" y="15" width="6" height="3" rx="0.5" />
        </svg>
      )

    case 'robot':
    case 'cobot':
    case 'collaborative_robot':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Base */}
          <rect x="8" y="19" width="8" height="3" rx="1" />
          {/* Lower arm */}
          <line x1="12" y1="19" x2="8" y2="13" />
          {/* Joint */}
          <circle cx="8" cy="13" r="1.5" />
          {/* Upper arm */}
          <line x1="8" y1="13" x2="15" y2="7" />
          {/* Wrist joint */}
          <circle cx="15" cy="7" r="1.5" />
          {/* Gripper */}
          <line x1="15" y1="7" x2="18" y2="4" />
          <line x1="18" y1="4" x2="19" y2="3" />
          <line x1="18" y1="4" x2="19" y2="5" />
        </svg>
      )

    case 'conveyor':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Belt top */}
          <line x1="3" y1="14" x2="21" y2="14" />
          {/* Belt bottom */}
          <line x1="3" y1="18" x2="21" y2="18" />
          {/* Left roller */}
          <circle cx="5" cy="16" r="2" />
          {/* Right roller */}
          <circle cx="19" cy="16" r="2" />
          {/* Flow arrows */}
          <path d="M8 10l3-2 3 2" />
          <path d="M11 8v-2" />
          {/* Package on belt */}
          <rect x="9" y="10" width="6" height="4" rx="0.5" />
        </svg>
      )

    case 'assembly':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Gear */}
          <circle cx="12" cy="12" r="4" />
          <circle cx="12" cy="12" r="1.5" />
          {/* Gear teeth */}
          <line x1="12" y1="3" x2="12" y2="6" />
          <line x1="12" y1="18" x2="12" y2="21" />
          <line x1="3" y1="12" x2="6" y2="12" />
          <line x1="18" y1="12" x2="21" y2="12" />
          <line x1="5.6" y1="5.6" x2="7.8" y2="7.8" />
          <line x1="16.2" y1="16.2" x2="18.4" y2="18.4" />
          <line x1="5.6" y1="18.4" x2="7.8" y2="16.2" />
          <line x1="16.2" y1="7.8" x2="18.4" y2="5.6" />
        </svg>
      )

    case 'milling':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Spindle */}
          <rect x="10" y="2" width="4" height="6" rx="1" />
          {/* Cutter head */}
          <circle cx="12" cy="11" r="3" />
          {/* Rotation arc */}
          <path d="M7 11a5 5 0 0 1 2.5-4.3" strokeDasharray="2 2" />
          <path d="M17 11a5 5 0 0 0-2.5-4.3" strokeDasharray="2 2" />
          {/* Workpiece / table */}
          <rect x="4" y="17" width="16" height="3" rx="1" />
          <rect x="8" y="14" width="8" height="3" rx="0.5" />
        </svg>
      )

    case 'turning':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Chuck / rotating workpiece */}
          <circle cx="9" cy="12" r="5" />
          <circle cx="9" cy="12" r="2" />
          {/* Tool holder */}
          <line x1="16" y1="12" x2="14" y2="12" />
          <path d="M16 9v6l4-1v-4z" />
          {/* Rotation arrow */}
          <path d="M5 5a8 8 0 0 1 4 1" />
          <path d="M5 5l1.5 1.5L4.5 7" />
        </svg>
      )

    case 'welding':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Torch body */}
          <line x1="6" y1="4" x2="12" y2="14" />
          <path d="M4 3h4l-2 3z" />
          {/* Weld point */}
          <circle cx="12" cy="16" r="1" fill="currentColor" />
          {/* Sparks */}
          <line x1="12" y1="16" x2="15" y2="13" />
          <line x1="12" y1="16" x2="16" y2="15" />
          <line x1="12" y1="16" x2="14" y2="19" />
          <line x1="12" y1="16" x2="9" y2="19" />
          {/* Workpiece */}
          <rect x="3" y="19" width="18" height="3" rx="1" />
        </svg>
      )

    case 'inspection':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Magnifying glass */}
          <circle cx="10" cy="10" r="6" />
          <line x1="14.5" y1="14.5" x2="20" y2="20" strokeWidth={2} />
          {/* Checkmark inside */}
          <path d="M7.5 10l2 2 3.5-4" />
        </svg>
      )

    case 'packaging':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Box */}
          <path d="M3 8l9-5 9 5v10l-9 5-9-5z" />
          <line x1="12" y1="3" x2="12" y2="23" />
          <line x1="3" y1="8" x2="12" y2="13" />
          <line x1="21" y1="8" x2="12" y2="13" />
        </svg>
      )

    case 'motor':
    case 'electric_motor':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Motor body circle */}
          <circle cx="12" cy="12" r="8" />
          {/* Lightning bolt */}
          <path d="M13 6l-3 6h4l-3 6" strokeWidth={2} />
          {/* Shaft */}
          <line x1="20" y1="12" x2="23" y2="12" strokeWidth={2} />
        </svg>
      )

    case 'rotary_transfer':
    case 'rotary_transfer_machine':
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          {/* Circular path */}
          <circle cx="12" cy="12" r="8" strokeDasharray="4 2" />
          {/* Center */}
          <circle cx="12" cy="12" r="2" />
          {/* Station dots around circle */}
          <circle cx="12" cy="4" r="1.5" fill="currentColor" />
          <circle cx="19" cy="8" r="1.5" fill="currentColor" />
          <circle cx="19" cy="16" r="1.5" fill="currentColor" />
          <circle cx="12" cy="20" r="1.5" fill="currentColor" />
          <circle cx="5" cy="16" r="1.5" fill="currentColor" />
          <circle cx="5" cy="8" r="1.5" fill="currentColor" />
          {/* Rotation arrow */}
          <path d="M16 3.5l-1 2h2z" fill="currentColor" />
        </svg>
      )

    default:
      return (
        <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
          <rect x="4" y="4" width="16" height="16" rx="2" />
          <circle cx="12" cy="12" r="3" />
        </svg>
      )
  }
}
