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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { FieldType } from './field-type.model';
import { WizardPageField } from '../../components/case-editor/domain';
import { Expose, Type } from 'class-transformer';
var ɵ0 = function () { return FieldType; }, ɵ1 = function () { return WizardPageField; };
// @dynamic
var CaseField = /** @class */ (function () {
    function CaseField() {
        this._list_items = [];
    }
    Object.defineProperty(CaseField.prototype, "value", {
        get: function () {
            if (this.field_type && this.field_type.type === 'DynamicList') {
                return this._value && this._value.value ? this._value.value.code : this._value;
            }
            else {
                return this._value;
            }
        },
        set: function (value) {
            this._value = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CaseField.prototype, "list_items", {
        get: function () {
            if (this.field_type && this.field_type.type === 'DynamicList') {
                return this._value && this._value.list_items ? this._value.list_items : this._list_items;
            }
            else {
                return this.field_type.fixed_list_items;
            }
        },
        set: function (items) {
            this._list_items = items;
        },
        enumerable: true,
        configurable: true
    });
    CaseField.prototype.isReadonly = function () {
        return typeof this.display_context === 'string' && this.display_context.toUpperCase() === 'READONLY';
    };
    CaseField.prototype.isLabel = function () {
        return this.field_type instanceof FieldType && this.field_type.type === 'Label';
    };
    CaseField.prototype.isDisplayModeFixed = function () {
        return typeof this.display_mode === 'string' && this.display_mode === 'FIXED';
    };
    CaseField.prototype.isDisplayContextTableView = function () {
        return typeof this.display_context_parameter === 'string' && this.display_context_parameter.trim().startsWith('#TABLE(');
    };
    __decorate([
        Type(ɵ0),
        __metadata("design:type", FieldType)
    ], CaseField.prototype, "field_type", void 0);
    __decorate([
        Type(ɵ1),
        __metadata("design:type", WizardPageField)
    ], CaseField.prototype, "wizardProps", void 0);
    __decorate([
        Expose(),
        __metadata("design:type", Object),
        __metadata("design:paramtypes", [Object])
    ], CaseField.prototype, "value", null);
    __decorate([
        Expose(),
        __metadata("design:type", Object),
        __metadata("design:paramtypes", [Object])
    ], CaseField.prototype, "list_items", null);
    __decorate([
        Expose(),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", []),
        __metadata("design:returntype", void 0)
    ], CaseField.prototype, "isReadonly", null);
    __decorate([
        Expose(),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", []),
        __metadata("design:returntype", void 0)
    ], CaseField.prototype, "isLabel", null);
    __decorate([
        Expose(),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", []),
        __metadata("design:returntype", void 0)
    ], CaseField.prototype, "isDisplayModeFixed", null);
    __decorate([
        Expose(),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", []),
        __metadata("design:returntype", void 0)
    ], CaseField.prototype, "isDisplayContextTableView", null);
    return CaseField;
}());
export { CaseField };
export { ɵ0, ɵ1 };
//# sourceMappingURL=case-field.model.js.map