/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { generateTextShadow, getShadowElement, removeClass } from '@tylertech/forge-core';
import { BaseAdapter } from '../core/base/base-adapter';
import { PRODUCT_ICON_CONSTANTS } from './product-icon-constants';
export class ProductIconAdapter extends BaseAdapter {
    constructor(component) {
        super(component);
        this._backgroundElement = getShadowElement(component, PRODUCT_ICON_CONSTANTS.selectors.PRODUCT_ICON_BACKGROUND);
        this._iconElement = getShadowElement(component, PRODUCT_ICON_CONSTANTS.selectors.PRODUCT_ICON);
        this._textElement = getShadowElement(component, PRODUCT_ICON_CONSTANTS.selectors.PRODUCT_TEXT);
    }
    setBackgroundColor(color) {
        this._backgroundElement.style.backgroundColor = color;
    }
    setIconColor(color) {
        this._iconElement.style.color = color;
        this._textElement.style.color = color;
    }
    setElementSize(value) {
        this._backgroundElement.style.height = `${value}px`;
        this._backgroundElement.style.width = `${value}px`;
    }
    setFontSize(value) {
        const textFontSize = value * PRODUCT_ICON_CONSTANTS.numbers.TEXT_FONT_SIZE_MODIFIER;
        const iconFontSize = value * PRODUCT_ICON_CONSTANTS.numbers.ICON_FONT_SIZE_MODIFIER;
        this._iconElement.style.setProperty('--forge-product-icon-font-size', `${iconFontSize}px`);
        this._textElement.style.setProperty('--forge-product-icon-font-size', `${textFontSize}px`);
        this._iconElement.style.fontSize = `var(--forge-product-icon-font-size, ${iconFontSize}px)`;
        this._textElement.style.fontSize = `var(--forge-product-icon-font-size, ${textFontSize}px)`;
    }
    removeIconClass(classes) {
        removeClass(classes, this._iconElement);
        removeClass(classes, this._textElement);
    }
    setTextShadow(hasShadow, iterations, shadowColor) {
        if (hasShadow) {
            const shadow = generateTextShadow(iterations, shadowColor);
            this._iconElement.style.textShadow = shadow;
            this._textElement.style.textShadow = shadow;
        }
        else {
            this._iconElement.style.removeProperty('text-shadow');
            this._textElement.style.removeProperty('text-shadow');
        }
    }
}
