import { ComprehensiveProps } from "../../DomainProps";
import SwitchView from "./SwitchView";

interface SwitchProps extends ComprehensiveProps {
    size:"small"|"medium"|"large",
}

const Switch = (props: SwitchProps) => {

    const onChange =(value:boolean) =>{
        props.onChange?.(null,props.screenDataField,value);
    }

    return (
        <section
            id={props.rootStyle?.id}
            className={props.rootStyle?.className}
            style={props.rootStyle?.inline}
        >
            <SwitchView
            widgetStyle={props.widgetStyle}
            size={props.size}
            value={props.value}
            onChange={onChange}
             />
        </section>
    )
}
export default Switch;