
package de.ivu.elect.presentation.konfiguration.form;

import javax.inject.Inject;

import de.ivu.elect.business.konfiguration.entity.Konfiguration;
import de.ivu.elect.jee.presentation.dynamicform.FormBuilder;
import de.ivu.elect.presentation.ViewFormBuilder;

public class KonfigurationViewFormBuilder extends ViewFormBuilder {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient CustomParameterViewFormBuilder customParameterViewFormBuilder;

  public KonfigurationViewFormBuilder() {
    super();
  }

  public void addProperties(FormBuilder formBuilder, Konfiguration konfiguration) {
    formBuilder.withId("konfiguration"); // Nur für JMeter relevant

    customParameterViewFormBuilder.addProperties(formBuilder, konfiguration, konfiguration.getProperties().getWertProperty()/* ELECTMUC-3034,
    UseCasePermission.KONFIGURATION_EDIT_SECRETS_CLEAR_TEXT*/);

    var lastProperty = formBuilder.lastProperty(); // Nur für JMeter relevant

    if (lastProperty != null) {
      formBuilder.selectProperty(lastProperty);
      formBuilder.withKey("konfigurationInput");
    }
  }
}
