/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { APP_BAR_HELP_BUTTON_CONSTANTS } from './app-bar-help-button-constants';
export class AppBarHelpButtonFoundation {
    constructor(_adapter) {
        this._adapter = _adapter;
        this._options = [];
        this._icon = APP_BAR_HELP_BUTTON_CONSTANTS.defaults.ICON;
        this._isInitialized = false;
    }
    initialize() {
        this._adapter.initialize();
        this._adapter.setMenuOptions(this._options);
        this._adapter.setIcon(this._icon);
        this._isInitialized = true;
    }
    disconnect() {
        this._adapter.destroy();
        this._isInitialized = false;
    }
    get options() {
        return this._options;
    }
    set options(value) {
        this._options = value.map(o => (Object.assign({}, o)));
        if (this._isInitialized) {
            this._adapter.setMenuOptions(value);
        }
    }
    get icon() {
        return this._icon;
    }
    set icon(value) {
        if (this._icon !== value) {
            this._icon = value || APP_BAR_HELP_BUTTON_CONSTANTS.defaults.ICON;
            if (this._isInitialized) {
                this._adapter.setIcon(value);
            }
            this._adapter.setHostAttribute(APP_BAR_HELP_BUTTON_CONSTANTS.attributes.ICON, this._icon);
        }
    }
}
