import { Component, Input, OnInit } from '@angular/core';
import { FormArray, FormGroup } from '@angular/forms';
import { DatasetDescriptionCompositeFieldEditorModel, DatasetDescriptionFieldEditorModel } from '../../dataset-description-form.model';
import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.service';

@Component({
	selector: 'app-form-composite-field',
	templateUrl: './form-composite-field.component.html',
	styleUrls: ['./form-composite-field.component.scss']
})
export class FormCompositeFieldComponent {

	@Input() datasetProfileId: String;
	@Input() form: FormGroup;
	@Input() isChild: Boolean = false;

	constructor(
		public visibilityRulesService: VisibilityRulesService,
		//private markForConsiderationService: MarkForConsiderationService,
	) {
	}

	ngOnInit() {
	}

	// addMultipleField(fieldIndex: number) {
	// 	const compositeFieldToBeCloned = (this.form.get('compositeFields').get('' + fieldIndex) as FormGroup).getRawValue();
	// 	const compositeField: DatasetDescriptionCompositeFieldEditorModel = new DatasetDescriptionCompositeFieldEditorModel().cloneForMultiplicity(compositeFieldToBeCloned);
	// 	(<FormArray>(this.form.get('compositeFields').get('' + fieldIndex).get('multiplicityItems'))).push(compositeField.buildForm());
	// }

	// markForConsideration() {
	// 	this.markForConsiderationService.markForConsideration(this.compositeField);
	// }
}
