/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { CustomElement, attachLightTemplate, coerceNumber, coerceBoolean, FoundationProperty } from '@tylertech/forge-core';
import { AppBarProfileButtonAdapter } from './app-bar-profile-button-adapter';
import { AppBarProfileButtonFoundation } from './app-bar-profile-button-foundation';
import { APP_BAR_PROFILE_BUTTON_CONSTANTS } from './app-bar-profile-button-constants';
import { ProfileCardComponent } from '../../profile-card';
import { IconButtonComponent } from '../../icon-button';
import { AvatarComponent } from '../../avatar';
import { PopupComponent } from '../../popup';
import { TooltipComponent } from '../../tooltip';
import { BaseComponent } from '../../core/base/base-component';
import { IconComponent } from '../../icon';
const template = '<template><forge-icon-button><button type=\"button\" aria-label=\"View profile card\"><forge-avatar aria-hidden=\"true\"></forge-avatar></button><forge-tooltip delay=\"500\" position=\"bottom\">View profile</forge-tooltip></forge-icon-button></template>';
/**
 * The web component class behind the `<forge-app-bar-profile-button>` custom element.
 *
 * @tag forge-app-bar-profile-button
 */
let AppBarProfileButtonComponent = class AppBarProfileButtonComponent extends BaseComponent {
    constructor() {
        super();
        this._foundation = new AppBarProfileButtonFoundation(new AppBarProfileButtonAdapter(this));
    }
    static get observedAttributes() {
        return [
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.FULL_NAME,
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.EMAIL,
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.AVATAR_IMAGE_URL,
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.AVATAR_LETTER_COUNT,
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.AVATAR_TEXT,
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.AVATAR_ICON,
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.SIGN_OUT_BUTTON,
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.PROFILE_BUTTON,
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.SIGN_OUT_BUTTON_TEXT,
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.PROFILE_BUTTON_TEXT,
            APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.OPEN
        ];
    }
    initializedCallback() {
        attachLightTemplate(this, template);
    }
    connectedCallback() {
        this._foundation.initialize();
    }
    disconnectedCallback() {
        this._foundation.disconnect();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.FULL_NAME:
                this.fullName = newValue;
                break;
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.EMAIL:
                this.email = newValue;
                break;
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.AVATAR_IMAGE_URL:
                this.avatarImageUrl = newValue;
                break;
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.AVATAR_LETTER_COUNT:
                this.avatarLetterCount = coerceNumber(newValue);
                break;
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.AVATAR_TEXT:
                this.avatarText = newValue;
                break;
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.AVATAR_ICON:
                this.avatarIcon = newValue;
                break;
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.SIGN_OUT_BUTTON:
                this.signOutButton = coerceBoolean(newValue);
                break;
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.PROFILE_BUTTON:
                this.profileButton = coerceBoolean(newValue);
                break;
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.SIGN_OUT_BUTTON_TEXT:
                this.signOutButtonText = newValue;
                break;
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.PROFILE_BUTTON_TEXT:
                this.profileButtonText = newValue;
                break;
            case APP_BAR_PROFILE_BUTTON_CONSTANTS.attributes.OPEN:
                this.open = coerceBoolean(newValue);
                break;
        }
    }
};
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "fullName", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "email", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "avatarImageUrl", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "avatarLetterCount", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "avatarText", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "avatarIcon", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "signOutButton", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "profileButton", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "signOutButtonText", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "profileButtonText", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "open", void 0);
__decorate([
    FoundationProperty()
], AppBarProfileButtonComponent.prototype, "profileCardBuilder", void 0);
AppBarProfileButtonComponent = __decorate([
    CustomElement({
        name: APP_BAR_PROFILE_BUTTON_CONSTANTS.elementName,
        dependencies: [
            PopupComponent,
            ProfileCardComponent,
            IconButtonComponent,
            IconComponent,
            AvatarComponent,
            TooltipComponent
        ]
    })
], AppBarProfileButtonComponent);
export { AppBarProfileButtonComponent };
