/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { APP_BAR_NOTIFICATION_BUTTON_CONSTANTS } from './app-bar-notification-button-constants';
export class AppBarNotificationButtonFoundation {
    constructor(_adapter) {
        this._adapter = _adapter;
        this._count = '0';
        this._dot = false;
        this._showBadge = false;
        this._isInitialized = false;
        this._icon = 'notifications';
    }
    initialize() {
        this._adapter.initialize();
        this._adapter.setCount(this._count);
        this._adapter.setBadgeType(this._dot);
        this._adapter.setBadgeTheme(this._theme);
        this._adapter.setBadgeVisible(this._showBadge);
        this._adapter.setIcon(this._icon);
        this._isInitialized = true;
    }
    destroy() {
        this._adapter.destroy();
        this._isInitialized = false;
    }
    get icon() {
        return this._icon;
    }
    set icon(value) {
        if (this._icon !== value) {
            this._icon = value;
            if (this._isInitialized) {
                this._adapter.setIcon(this._icon);
            }
            this._adapter.setHostAttribute(APP_BAR_NOTIFICATION_BUTTON_CONSTANTS.attributes.ICON, this._icon);
        }
    }
    get count() {
        return this._count;
    }
    set count(value) {
        if (this._count !== value) {
            this._count = value;
            if (this._isInitialized) {
                this._adapter.setCount(this._count);
            }
            this._adapter.setHostAttribute(APP_BAR_NOTIFICATION_BUTTON_CONSTANTS.attributes.COUNT, this._count);
        }
    }
    get dot() {
        return this._dot;
    }
    set dot(value) {
        value = Boolean(value);
        if (this._dot !== value) {
            this._dot = value;
            if (this._isInitialized) {
                this._adapter.setBadgeType(this._dot);
            }
            this._adapter.toggleHostAttribute(APP_BAR_NOTIFICATION_BUTTON_CONSTANTS.attributes.DOT, this._dot);
        }
    }
    get theme() {
        return this._theme;
    }
    set theme(value) {
        if (this._theme !== value) {
            this._theme = value;
            if (this._isInitialized) {
                this._adapter.setBadgeTheme(this._theme);
                this._adapter.setHostAttribute(APP_BAR_NOTIFICATION_BUTTON_CONSTANTS.attributes.THEME, this._theme);
            }
        }
    }
    get showBadge() {
        return this._showBadge;
    }
    set showBadge(value) {
        value = Boolean(value);
        if (this._showBadge !== value) {
            this._showBadge = value;
            if (this._isInitialized) {
                this._adapter.setBadgeVisible(this._showBadge);
            }
            this._adapter.toggleHostAttribute(APP_BAR_NOTIFICATION_BUTTON_CONSTANTS.attributes.SHOW_BADGE, this._showBadge);
        }
    }
}
