// Import necessary WordPress modules.
const { ToggleControl } = wp.components;
const { __ } = wp.i18n;

/**
 * ToggleOptionControl Component.
 *
 * A reusable toggle switch UI component.
 * Used for enabling/disabling boolean options (e.g., show/hide image, title, etc.).
 *
 * Props:
 * @param {string} label - The label to display beside the toggle switch.
 * @param {boolean} checked - The current on/off state of the toggle.
 * @param {function} onChange - Callback function to update the toggle value.
 */
const ToggleOptionControl = ({ label, checked, onChange }) => {
  return (
    <ToggleControl
      label={__( label, 'journey-timeline-block' )} // Localized label for display.
      checked={checked} // Boolean state to indicate whether toggle is on or off.
      onChange={onChange} // Callback function triggered when toggle state changes.
    />
  );
};

export default ToggleOptionControl;
