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

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

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

public class EmailVorgangStatusProperty extends AbstractEnumProperty<EmailVorgangStatusType> {

  private final EmailVorgang entity;

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

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

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

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

  @Override
  public EmailVorgangStatusType getValue() {
    return entity.getStatus();
  }

  @Override
  public void setValue(EmailVorgangStatusType emailVorgangStatusType) {
    entity.setStatus(emailVorgangStatusType);
  }

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

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

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