"use client";
import React, { useState } from "react";
import Switch from "./Switch2";

interface TextSwitchProps {
  label: string;
  checked: boolean;
  onText?: string;
  offText?: string;
  defaultChecked?: boolean;
  disabled?: boolean;
  onChange?: (checked: boolean) => void;
}

const TextSwitch: React.FC<TextSwitchProps> = ({
  label,
  checked,
  onText,
  offText,
  defaultChecked = false,
  disabled = false,
  onChange,
}) => {

  return (
    <div className="flex items-center gap-2">
      <Switch
        label={label}
        checked={checked}
        disabled={disabled}
        onChange={onChange}
      />
      <span className="text-sm font-medium">
        {checked ? onText ?? "" : offText ?? ""}
      </span>
    </div>
  );
};

export default TextSwitch;
