/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { coerceBoolean, ensureChild, FoundationProperty, coerceNumberArray } from '@tylertech/forge-core';
import { BaseComponent } from '../../core/base/base-component';
import { BASE_DATE_PICKER_CONSTANTS } from './base-date-picker-constants';
export class BaseDatePickerComponent extends BaseComponent {
    constructor() {
        super();
    }
    async connectedCallback() {
        if (this.querySelector(BASE_DATE_PICKER_CONSTANTS.selectors.INPUT)) {
            this._foundation.initialize();
        }
        else {
            await ensureChild(this, BASE_DATE_PICKER_CONSTANTS.selectors.INPUT);
            this._foundation.initialize();
        }
    }
    disconnectedCallback() {
        this._foundation.disconnect();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.MIN:
                this.min = newValue;
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.MAX:
                this.max = newValue;
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.OPEN:
                this.open = coerceBoolean(newValue);
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.POPUP_CLASSES:
                this.popupClasses = newValue;
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.DISABLED:
                this.disabled = coerceBoolean(newValue);
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.MASKED:
                this.masked = coerceBoolean(newValue);
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.SHOW_MASK_FORMAT:
                this.showMaskFormat = coerceBoolean(newValue);
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.MASK_FORMAT:
                this.maskFormat = newValue;
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.VALUE_MODE:
                this.valueMode = newValue;
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.ALLOW_INVALID_DATE:
                this.allowInvalidDate = coerceBoolean(newValue);
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.SHOW_TODAY:
                this.showToday = coerceBoolean(newValue);
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.SHOW_CLEAR:
                this.showClear = coerceBoolean(newValue);
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.DISABLED_DAYS_OF_WEEK:
                this.disabledDaysOfWeek = coerceNumberArray(newValue);
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.YEAR_RANGE:
                this.yearRange = newValue;
                break;
            case BASE_DATE_PICKER_CONSTANTS.observedAttributes.LOCALE:
                this.locale = newValue;
                break;
        }
    }
}
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "value", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "min", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "max", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "disabledDates", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "open", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "popupClasses", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "disabled", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "masked", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "maskFormat", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "showMaskFormat", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "valueMode", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "notifyInputValueChanges", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "allowInvalidDate", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "showToday", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "showClear", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "parseCallback", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "formatCallback", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "prepareMaskCallback", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "disabledDaysOfWeek", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "disableDayCallback", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "yearRange", void 0);
__decorate([
    FoundationProperty()
], BaseDatePickerComponent.prototype, "locale", void 0);
