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

import de.ivu.elect.business.email.entity.EmailVorgang;
import de.ivu.elect.business.email.entity.EmailVorgangType;
import de.ivu.elect.jee.presentation.dynamicform.AbstractEnumProperty;

import java.util.Arrays;
import java.util.List;

public class EmailVorgangTypProperty extends AbstractEnumProperty<EmailVorgangType> {

  private final EmailVorgang entity;

  public EmailVorgangTypProperty(EmailVorgang entity) {
    super();
    this.entity = entity;
  }

  @Override
  protected Class<EmailVorgangType> getEnumClass() {
    return EmailVorgangType.class;
  }

  @Override
  public String getDefaultLabel() {
    return getMessage("email.vorgang.column.typ");
  }

  @Override
  public boolean getDefaultRequired() {
    return false;
  }

  @Override
  public EmailVorgangType getValue() {
    return entity.getTyp();
  }

  @Override
  public void setValue(EmailVorgangType emailVorgangType) {
    entity.setTyp(emailVorgangType);
  }

  @Override
  public List<EmailVorgangType> getValues() {
    return Arrays.asList(EmailVorgangType.values());
  }

  @Override
  public boolean hasNoSelectionItem() {
    return true;
  }

  @Override
  public String getNoSelectionLabel() {
    return "";
  }
}
