import { Component, EventEmitter, Input, Output } from '@angular/core';
import { SurveyFormQuestionComponent } from '../survey-form-question/survey-form-question.component';
import { CommonModule } from '@angular/common';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
export class SurveyFormSectionComponent {
    constructor() {
        this.questionValues = new EventEmitter();
    }
    getField(questionIndex) {
        let field = {};
        if (this.childFields) {
            const filterList = this.childFields.filter((childField) => childField.controlIndex === questionIndex);
            field = filterList ? filterList[0] : {};
        }
        return field;
    }
    updateQuestionValues(event) {
        this.questionValues.emit(event);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SurveyFormSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SurveyFormSectionComponent, isStandalone: true, selector: "ws-app-survey-form-section", inputs: { childQuestionsFormArray: "childQuestionsFormArray", childFields: "childFields", sectionField: "sectionField" }, outputs: { questionValues: "questionValues" }, ngImport: i0, template: "<div class=\"section-wrapper\">\n    <div class=\"section-title\">\n      {{sectionField?.values[0]?.heading}}\n    </div>\n    <div class=\"section-desc text-xs font-normal pt-2\">{{sectionField?.values[0]?.subHeading}}</div>\n    <hr class=\"opacity-50 mb-0\">\n    <div class=\"section-content pt-5\">\n        <ng-container *ngFor=\"let questionForm of childQuestionsFormArray?.controls\">\n          <ws-app-survey-form-question [questionForm]=\"questionForm\"\n           [fieldDetails]=\"getField(questionForm.value.questionIndex)\"\n           (questionValues)=\"updateQuestionValues($event)\"></ws-app-survey-form-question>\n        </ng-container>\n    </div>\n  </div>", styles: [".section-wrapper{background:#1b4ca114;padding:16px 16px 8px;border-radius:8px}.section-title{font-family:Montserrat;font-size:16px;font-weight:600;line-height:19.5px;text-align:left;text-underline-position:from-font;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}\n"], dependencies: [{ kind: "component", type: SurveyFormQuestionComponent, selector: "ws-app-survey-form-question", inputs: ["questionForm", "fieldDetails"], outputs: ["questionValues"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SurveyFormSectionComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ws-app-survey-form-section', standalone: true, imports: [SurveyFormQuestionComponent, CommonModule], template: "<div class=\"section-wrapper\">\n    <div class=\"section-title\">\n      {{sectionField?.values[0]?.heading}}\n    </div>\n    <div class=\"section-desc text-xs font-normal pt-2\">{{sectionField?.values[0]?.subHeading}}</div>\n    <hr class=\"opacity-50 mb-0\">\n    <div class=\"section-content pt-5\">\n        <ng-container *ngFor=\"let questionForm of childQuestionsFormArray?.controls\">\n          <ws-app-survey-form-question [questionForm]=\"questionForm\"\n           [fieldDetails]=\"getField(questionForm.value.questionIndex)\"\n           (questionValues)=\"updateQuestionValues($event)\"></ws-app-survey-form-question>\n        </ng-container>\n    </div>\n  </div>", styles: [".section-wrapper{background:#1b4ca114;padding:16px 16px 8px;border-radius:8px}.section-title{font-family:Montserrat;font-size:16px;font-weight:600;line-height:19.5px;text-align:left;text-underline-position:from-font;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}\n"] }]
        }], propDecorators: { childQuestionsFormArray: [{
                type: Input
            }], childFields: [{
                type: Input
            }], sectionField: [{
                type: Input
            }], questionValues: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3VydmV5LWZvcm0tc2VjdGlvbi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9saWJyYXJ5L3N1bmJpcmQtY2IvdG9jL3NyYy9saWIvY29tcG9uZW50cy9zdXJ2ZXktZm9ybS1z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