var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { html, customElement, property, state, query } from '../../../external/lit/index.js';
import { UmbLitElement } from '../../core/lit-element/index.js';
import { UmbChangeEvent } from '../../core/event/index.js';
/**
 * @element umb-property-editor-ui-value-type
 */
let UmbPropertyEditorUIValueTypeElement = class UmbPropertyEditorUIValueTypeElement extends UmbLitElement {
    constructor() {
        super(...arguments);
        this._value = undefined;
        this._options = [
            { name: 'String', value: 'STRING' },
            { name: 'Decimal', value: 'DECIMAL' },
            { name: 'Date/Time', value: 'DATETIME' },
            { name: 'Time', value: 'TIME' },
            { name: 'Integer', value: 'INT' },
            { name: 'Big Integer', value: 'BIGINT' },
            { name: 'Long String', value: 'TEXT' },
        ];
    }
    get value() {
        return this._value;
    }
    set value(value) {
        this._value = value;
        const selected = this._options.filter((option) => {
            if (this.selectEl && option.value === this.value)
                this.selectEl.value = this.value;
            return (option.selected = option.value === this.value);
        });
        if (selected.length === 0) {
            this._options[0].selected = true;
        }
    }
    #onChange(e) {
        this.value = e.target.value;
        this.dispatchEvent(new UmbChangeEvent());
    }
    render() {
        return html `<uui-select
			label="Select a value type"
			.options="${this._options}"
			@change="${this.#onChange}"></uui-select>`;
    }
};
__decorate([
    property()
], UmbPropertyEditorUIValueTypeElement.prototype, "value", null);
__decorate([
    query('uui-select')
], UmbPropertyEditorUIValueTypeElement.prototype, "selectEl", void 0);
__decorate([
    state()
], UmbPropertyEditorUIValueTypeElement.prototype, "_options", void 0);
__decorate([
    property({ attribute: false })
], UmbPropertyEditorUIValueTypeElement.prototype, "config", void 0);
UmbPropertyEditorUIValueTypeElement = __decorate([
    customElement('umb-property-editor-ui-value-type')
], UmbPropertyEditorUIValueTypeElement);
export { UmbPropertyEditorUIValueTypeElement };
export default UmbPropertyEditorUIValueTypeElement;
