import { Checkbox } from "@progress/kendo-react-inputs";
import { Style } from "../../DomainProps";
import withValidations from "../../../hoc/withValidations";
import withToolTip from "../../../hoc/withToolTip";
import withHelperText from "../../../hoc/withHelperText";
import withLabel from "../../../hoc/withLabel";

type CheckboxViewProps = {
  widgetStyle?: Style;
  value?: boolean;
  disabled?: boolean;
  defaultValue?: boolean;
  name?: string;
  readOnly?: boolean;
  onChange: (event: any) => void;
};

const CheckboxView = (props: CheckboxViewProps) => {
  return (
    <Checkbox
      style={props.widgetStyle?.inline ?? undefined}
      id={props.widgetStyle?.id}
      className={props.widgetStyle?.className}
      value={props.value !== undefined ? props.value : false}
      name={props.name}
      disabled={props.disabled}
      defaultValue={props.defaultValue}
      onChange={props.onChange}
      readOnly={props.readOnly}
    />
  );
};
export default withValidations(
  withToolTip(withHelperText(withLabel(CheckboxView)))
);