import { FormGroup } from '@angular/forms';
import { FreeTextFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';

export class FreeTextFieldDataEditorModel extends FieldDataEditorModel<FreeTextFieldDataEditorModel> {

	buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
		const formGroup = this.formBuilder.group({
			label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('FreeTextFieldDataEditorModel.label')) }]
		});
		return formGroup;
	}

	fromModel(item: FreeTextFieldData): FreeTextFieldDataEditorModel {
		this.label = item.label;
		return this;
	}
}
