import React from 'react';

interface ToggleOption {
  value: string;
  label: string;
}

interface ToggleSwitchProps {
  options: ToggleOption[];
  value: string;
  onChange: (value: string) => void;
  className?: string;
}

function ToggleSwitch({ options, value, onChange, className = '' }: ToggleSwitchProps) {
  return (
    <div className={`toggle-switch ${className}`} role="radiogroup">
      {options.map((option) => (
        <button
          key={option.value}
          className={value === option.value ? 'active' : ''}
          onClick={() => onChange(option.value)}
          role="radio"
          aria-checked={value === option.value}
        >
          {option.label}
        </button>
      ))}
    </div>
  );
}

export default ToggleSwitch;
