import React from 'react';
import { FormField, ToggleSwitch } from '@wix/design-system';

export interface FieldPiiToggleProps {
  label: string;
  checked: boolean;
  onChange: (v: boolean) => void;
  disabled?: boolean;
}

export const FieldPiiToggle = ({
  label,
  checked,
  onChange,
  disabled,
}: FieldPiiToggleProps) => (
  <FormField label={label} labelPlacement="right" stretchContent={false}>
    <ToggleSwitch
      checked={checked}
      onChange={(e) => onChange(e.target.checked)}
      disabled={disabled}
    />
  </FormField>
);
