<div *ngIf="form && this.visibilityRulesService.checkElementVisibility(this.form.get('id').value)" [id]="this.form.get('id').value"
 [formGroup]="form" [ngSwitch]="this.form.get('viewStyle').value.renderStyle" class="dynamic-form-field row">

	<h5 *ngIf="this.form.get('title').value && !isChild">{{this.form.get('title').value}}</h5>
	<mat-icon *ngIf="this.form.get('additionalInformation').value && !isChild" matTooltip="{{this.form.get('additionalInformation').value}}">info</mat-icon>

	<h5 *ngIf="this.form.get('description').value && !isChild" class="col-12">{{this.form.get('description').value}}
	</h5>
	<h5 *ngIf="this.form.get('extendedDescription').value && !isChild" class="col-12">
		<i>{{this.form.get('extendedDescription').value}}</i>
	</h5>
	<mat-form-field *ngSwitchCase="datasetProfileFieldViewStyleEnum.FreeText" class="col-12">
		<input matInput [formControl]="form.get('value')" placeholder="{{form.get('data').value.label}}" [required]="form.get('validationRequired').value">
		<mat-error *ngIf="form.get('value')['errors'] && form.get('value')['errors']['required']">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
	</mat-form-field>

	<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.ComboBox" class="col-12">
		<div class="row">
			<mat-form-field class="col-md-12" *ngIf="form.get('data').value.type === datasetProfileComboBoxTypeEnum.Autocomplete">
				<div *ngIf="form.get('data').value.multiAutoComplete">
					<app-multiple-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
					 [configuration]="multipleAutoCompleteConfiguration">
					</app-multiple-auto-complete>
				</div>
				<div *ngIf="!(form.get('data').value.multiAutoComplete)">
					<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
					 [configuration]="singleAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
					</app-single-auto-complete>
					<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
					</mat-error>
				</div>
				<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
			</mat-form-field>
			<mat-form-field *ngIf="form.get('data').value.type === datasetProfileComboBoxTypeEnum.WordList" class="col-md-12">
				<mat-select [formControl]="form.get('value')" placeholder="{{ form.get('data').value.label | translate }}" [required]="form.get('validationRequired').value">
					<mat-option *ngFor="let opt of form.get('data').value.options" [value]="opt.value">{{opt.label}}
					</mat-option>
				</mat-select>
				<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
				</mat-error>
			</mat-form-field>
		</div>
	</div>

	<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.InternalDmpEntities" class="col-12">
		<div class="row">
			<mat-form-field class="col-md-12" *ngIf="form.get('data').value.type === this.datasetProfileInternalDmpEntitiesTypeEnum.Researchers">
				<div *ngIf="form.get('data').value.multiAutoComplete">
					<app-multiple-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
					 [configuration]="multipleAutoCompleteConfiguration">
					</app-multiple-auto-complete>
				</div>
				<div *ngIf="!(form.get('data').value.multiAutoComplete)">
					<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
					 [configuration]="singleAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
					</app-single-auto-complete>
					<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
					</mat-error>
				</div>
				<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
			</mat-form-field>
			<mat-form-field class="col-md-12" *ngIf="form.get('data').value.type === this.datasetProfileInternalDmpEntitiesTypeEnum.Datasets">
				<div *ngIf="form.get('data').value.multiAutoComplete">
					<app-multiple-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
					 [configuration]="multipleAutoCompleteConfiguration">
					</app-multiple-auto-complete>
				</div>
				<div *ngIf="!(form.get('data').value.multiAutoComplete)">
					<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
					 [configuration]="singleAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
					</app-single-auto-complete>
					<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
					</mat-error>
				</div>
				<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
			</mat-form-field>
			<mat-form-field class="col-md-12" *ngIf="form.get('data').value.type === this.datasetProfileInternalDmpEntitiesTypeEnum.Dmps">
				<div *ngIf="form.get('data').value.multiAutoComplete">
					<app-multiple-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
					 [configuration]="multipleAutoCompleteConfiguration">
					</app-multiple-auto-complete>
				</div>
				<div *ngIf="!(form.get('data').value.multiAutoComplete)">
					<app-single-auto-complete placeholder="{{ form.get('data').value.label | translate }}" [formControl]="form.get('value')"
					 [configuration]="singleAutoCompleteConfiguration" [required]="form.get('validationRequired').value">
					</app-single-auto-complete>
					<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
					</mat-error>
				</div>
				<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
			</mat-form-field>
		</div>
	</div>

	<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.CheckBox" class="col-12">
		<mat-checkbox [formControl]="form.get('value')" [required]="form.get('validationRequired').value">
			{{form.get('data').value.label}}</mat-checkbox>
	</div>

	<mat-form-field *ngSwitchCase="datasetProfileFieldViewStyleEnum.TextArea" class="col-12">
		<textarea matInput [formControl]="form.get('value')" matTextareaAutosize matAutosizeMinRows="2" matAutosizeMaxRows="10" [required]="form.get('validationRequired').value"
		 placeholder="{{ form.get('data').value.label | translate }}"></textarea>
		<button mat-icon-button *ngIf="!form.get('value').disabled && form.get('value').value" matSuffix aria-label="Clear" (click)="this.form.patchValue({'value': ''})">
			<mat-icon>close</mat-icon>
		</button>
		<mat-error *ngIf="form.get('value')['errors'] && form.get('value')['errors']['required']">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
	</mat-form-field>

	<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.BooleanDecision" class="col-12">
		<mat-radio-group [formControl]="form.get('value')" [required]="form.get('validationRequired').value">
			<mat-radio-button class="radio-button-item" name="{{form.get('id').value}}" value="true">{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.ACTIONS.YES" | translate }}</mat-radio-button>
			<mat-radio-button class="radio-button-item" name="{{form.get('id').value}}" value="false">{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.ACTIONS.NO" | translate }}</mat-radio-button>
		</mat-radio-group>
		<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
		</mat-error>
	</div>

	<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.RadioBox" class="col-12">
		<mat-radio-group [formControl]="form.get('value')" [required]="form.get('validationRequired').value">
			<mat-radio-button *ngFor="let option of form.get('data').value.options let index = index" class="radio-button-item" [value]="option.value">{{option.label}}</mat-radio-button>
		</mat-radio-group>
		<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
		</mat-error>
	</div>

	<mat-form-field *ngSwitchCase="datasetProfileFieldViewStyleEnum.DatePicker" class="col-12">
		<input matInput placeholder="{{ form.get('data').value.label | translate }}" class="table-input" [matDatepicker]="date" [required]="form.get('validationRequired').value"
		 [formControl]="form.get('value')">
		<mat-datepicker-toggle matSuffix [for]="date"></mat-datepicker-toggle>
		<mat-datepicker #date></mat-datepicker>
		<mat-error *ngIf="form.get('value').hasError('required')">
			{{'GENERAL.VALIDATION.REQUIRED' | translate}}
		</mat-error>
	</mat-form-field>
</div>
