import { Component } from '@angular/core';
import { AbstractFieldReadComponent } from '../base-field/abstract-field-read.component';
import * as i0 from "@angular/core";
import * as i1 from "rpx-xui-translation";
import * as i2 from "./dynamic-radio-list.pipe";
export class ReadDynamicRadioListFieldComponent extends AbstractFieldReadComponent {
    ngOnInit() {
        /**
         *
         * Reassigning list_items from formatted_list when list_items is empty
         */
        if (!this.caseField.list_items && this.caseField.formatted_value && this.caseField.formatted_value.list_items) {
            this.caseField.list_items = this.caseField.formatted_value.list_items;
        }
        /**
         *
         * Seems formatted_value can also be empty for DynamicRadioList's. Reassigning list_items from value.list_items in that case
         */
        if (!this.caseField.list_items && this.caseField.value && this.caseField.value.list_items) {
            this.caseField.list_items = this.caseField.value.list_items;
        }
    }
    static ɵfac = /*@__PURE__*/ (() => { let ɵReadDynamicRadioListFieldComponent_BaseFactory; return function ReadDynamicRadioListFieldComponent_Factory(__ngFactoryType__) { return (ɵReadDynamicRadioListFieldComponent_BaseFactory || (ɵReadDynamicRadioListFieldComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadDynamicRadioListFieldComponent)))(__ngFactoryType__ || ReadDynamicRadioListFieldComponent); }; })();
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ReadDynamicRadioListFieldComponent, selectors: [["ccd-read-dynamic-radio-list-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 4, vars: 6, consts: [[1, "text-16"]], template: function ReadDynamicRadioListFieldComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "span", 0);
            i0.ɵɵtext(1);
            i0.ɵɵpipe(2, "ccdDynamicRadioList");
            i0.ɵɵpipe(3, "rpxTranslate");
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵadvance();
            i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 4, i0.ɵɵpipeBind2(2, 1, ctx.caseField.value, ctx.caseField.list_items)));
        } }, dependencies: [i1.RpxTranslatePipe, i2.DynamicRadioListPipe], encapsulation: 2 });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReadDynamicRadioListFieldComponent, [{
        type: Component,
        args: [{
                selector: 'ccd-read-dynamic-radio-list-field',
                template: '<span class="text-16">{{caseField.value | ccdDynamicRadioList:caseField.list_items | rpxTranslate}}</span>',
            }]
    }], null, null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ReadDynamicRadioListFieldComponent, { className: "ReadDynamicRadioListFieldComponent", filePath: "lib/shared/components/palette/dynamic-radio-list/read-dynamic-radio-list-field.component.ts", lineNumber: 8 }); })();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVhZC1keW5hbWljLXJhZGlvLWxpc3QtZmllbGQuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY2NkLWNhc2UtdWktdG9vbGtpdC9zcmMvbGliL3NoYXJlZC9jb21wb25lbnRzL3BhbGV0dGUvZHluYW1pYy1yYWRpby1saXN0L3JlYWQtZHluYW1pYy1yYWRpby1saXN0LWZpZWxkLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFVLE1BQU0sZUFBZSxDQUFDO0FBQ2xELE9BQU8sRUFBRSwwQkFBMEIsRUFBRSxNQUFNLDZDQUE2QyxDQUFDOzs7O0FBTXpGLE1BQU0sT0FBTyxrQ0FBbUMsU0FBUSwwQkFBMEI7SUFFekUsUUFBUTtRQUNiOzs7V0FHRztRQUNILElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLFVBQVUsSUFBSSxJQUFJLENBQUMsU0FBUyxDQUFDLGVBQWUsSUFBSSxJQUFJLENBQUMsU0FBUyxDQUFDLGVBQWUsQ0FBQyxVQUFVLEVBQUUsQ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