import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/shared/common/ui/select";
import { BarChart3, PieChart, Table as TableIcon } from "lucide-react";
import { useTranslation } from "react-i18next";
interface ChartToggleProps {
  value: "pie" | "bar" | "table";
  onChange: (value: "pie" | "bar" | "table") => void;
}

export function ChartToggle({ value, onChange }: ChartToggleProps) {
  const { t } = useTranslation();
  return (
    <Select
      value={value}
      onValueChange={(val) => onChange(val as "pie" | "bar" | "table")}
    >
      <SelectTrigger className="w-[128px] h-7 text-xs border-gray-200 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 dark:text-gray-200">
        <SelectValue placeholder="Chart Type" />
      </SelectTrigger>
      <SelectContent>
        <SelectItem value="pie" className="flex items-center gap-2 text-xs">
          <PieChart className="h-3 w-3" />
          <span>{t('dashboard.pieChart')}</span>
        </SelectItem>
        <SelectItem value="bar" className="flex items-center gap-2 text-xs">
          <BarChart3 className="h-3 w-3" />
          <span>{t('dashboard.barChart')}</span>
        </SelectItem>
        <SelectItem value="table" className="flex items-center gap-2 text-xs">
          <TableIcon className="h-3 w-3" />
          <span>{t('dashboard.table')}</span>
        </SelectItem>
      </SelectContent>
    </Select>
  );
}