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

import de.ivu.elect.business.email.entity.Email;
import de.ivu.elect.business.email.entity.EmailStatusType;
import de.ivu.elect.jee.presentation.dynamicform.AbstractEnumProperty;

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

public class EmailStatusProperty extends AbstractEnumProperty<EmailStatusType> {

  private final Email entity;

  public EmailStatusProperty(Email entity) {
    super();
    this.entity = entity;
  }

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

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

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

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

  @Override
  public void setValue(EmailStatusType emailStatusType) {
    entity.setStatus(emailStatusType);
  }

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

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

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