import * as React from "react";

export interface SwitchProps {
  id?: string;
  checked?: boolean;
  onCheckedChange?: (checked: boolean) => void;
  disabled?: boolean;
  className?: string;
}

export const Switch = React.forwardRef<HTMLInputElement, SwitchProps>(
  ({ id, checked, onCheckedChange, disabled, className = "" }, ref) => {
    return (
      <input
        type="checkbox"
        role="switch"
        ref={ref}
        id={id}
        checked={checked}
        onChange={(e) => onCheckedChange?.(e.target.checked)}
        disabled={disabled}
        className={`w-11 h-6 rounded-full ${className}`}
      />
    );
  }
);

Switch.displayName = "Switch";
