/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { LABEL_CONSTANTS } from '../../label';
import { RADIO_GROUP_CONSTANTS } from './radio-group-constants';
export class RadioGroupFoundation {
    constructor(_adapter) {
        this._adapter = _adapter;
        this._disabled = false;
        this._labelConnectedListener = (evt) => this._handleLabelConnected(evt);
    }
    initialize() {
        this._adapter.addHostListener(LABEL_CONSTANTS.events.CONNECTED, this._labelConnectedListener);
    }
    _handleLabelConnected(evt) {
        // Stop the label from being seen by any ancestor elements that might try to connect to it
        evt.stopPropagation();
        this._adapter.attachLabel(evt.target);
    }
    get disabled() {
        return this._disabled;
    }
    set disabled(value) {
        if (this._disabled !== value) {
            this._disabled = value;
            this._adapter.setDisabled(value);
            this._adapter.toggleHostAttribute(RADIO_GROUP_CONSTANTS.attributes.DISABLED, value);
        }
    }
}
