/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { getShadowElement, toggleClass } from '@tylertech/forge-core';
import { BaseAdapter } from '../core/base/base-adapter';
import { APP_BAR_CONSTANTS } from './app-bar-constants';
/**
 * Provides facilities for interacting with the internal DOM of `AppBarComponent`.
 */
export class AppBarAdapter extends BaseAdapter {
    constructor(component) {
        super(component);
        this._rootElement = getShadowElement(component, APP_BAR_CONSTANTS.selectors.ROOT);
        this._titleElement = getShadowElement(component, APP_BAR_CONSTANTS.selectors.TITLE);
        this._bottomElement = getShadowElement(component, APP_BAR_CONSTANTS.selectors.BOTTOM);
        this._bottomSlotElement = getShadowElement(component, APP_BAR_CONSTANTS.selectors.BOTTOM_SLOT);
        this._centerSlotElement = getShadowElement(component, APP_BAR_CONSTANTS.selectors.CENTER_SLOT);
        this._centerSectionElement = getShadowElement(component, APP_BAR_CONSTANTS.selectors.CENTER_SECTION);
    }
    /**
     * Sets the title text value.
     * @param {string} value The title text.
     */
    setTitleText(value) {
        this._titleElement.textContent = value;
    }
    setDense(value) {
        toggleClass(this._rootElement, value, APP_BAR_CONSTANTS.classes.DENSE);
    }
    setRaised(value) {
        toggleClass(this._rootElement, value, APP_BAR_CONSTANTS.classes.RAISED);
    }
    setFixed(value) {
        toggleClass(this._rootElement, value, APP_BAR_CONSTANTS.classes.FIXED);
    }
    addBottomClass(name) {
        this._bottomElement.classList.add(name);
    }
    removeBottomClass(name) {
        this._bottomElement.classList.remove(name);
    }
    addBottomSlotListener(listener) {
        this._bottomSlotElement.addEventListener('slotchange', listener);
    }
    addCenterSlotListener(listener) {
        this._centerSlotElement.addEventListener('slotchange', listener);
    }
    setCenterSlotVisibility() {
        if (this._centerSlotElement.assignedNodes().length) {
            this._centerSectionElement.style.removeProperty('display');
            this._rootElement.classList.remove(APP_BAR_CONSTANTS.classes.NO_CENTER);
        }
        else {
            this._centerSectionElement.style.display = 'none';
            this._rootElement.classList.add(APP_BAR_CONSTANTS.classes.NO_CENTER);
        }
    }
}
