import * as React from 'react';
import Checkbox = require('react-bootstrap/lib/Checkbox');

import {FormControl, FormControlDefaultProps, FormControlProps} from "./FormControl";

export type CheckboxControlProps = Checkbox.CheckboxProps & {
    removeName?: boolean;
} & FormControlProps & Partial<CheckboxControlDefaultProps>;

export type CheckboxControlDefaultProps = {
    testAutomationId: string;
    removeName: boolean;
} & FormControlDefaultProps;

type Value = boolean | null;

type ConverterOutput = {
    checked: Value;
}

export class CheckboxControl extends FormControl<CheckboxControlProps & React.HTMLProps<CheckboxControl>> {
    // @ts-ignore
    getValue(): Value;

    // @ts-ignore
    inputConverter(value: Value): ConverterOutput;

    // @ts-ignore
    outputConverter(e: React.ChangeEvent<HTMLInputElement>): Value;

    getInputDOMNode(): HTMLInputElement;

    testAutomationIdHandler(): void;
}