'use strict';

import React from 'react';
import {FormGroup} from './FormGroup';
import {DateRangePickerControl, DateRangePickerCtrl} from './DateRangePickerControl';

export class DateRangePicker extends FormGroup {
    static propTypes = {
        ...DateRangePickerCtrl.propTypes,
        ...FormGroup.propTypes
    };

    static defaultProps = {
        ...DateRangePickerCtrl.defaultProps,
        ...FormGroup.defaultProps,
        id: 'dateRangePicker',
        testAutomationId: 'dateRangePicker'
    };

    renderInput(hasError) {
        let ariaDescProps = this.getAriaDescProps(hasError);
        return (
            <DateRangePickerControl
                {...this.props}
                ref="control"
                {...ariaDescProps}
                hasFormGroupContainer
            />
        );
    }
}
