
package de.ivu.elect.presentation.dokumente.table;

import de.ivu.elect.business.dokumente.entity.DokumentArchiveUploadResultEntry;
import de.ivu.elect.jee.faces.Messages;
import de.ivu.elect.jee.presentation.Icons;
import de.ivu.elect.jee.presentation.dynamictable.ColumnType;
import de.ivu.elect.presentation.table.AbstractColumnEntry;

public class DokumentArchiveUploadResultEntryStatusColumn extends AbstractColumnEntry<DokumentArchiveUploadResultEntry> {

  private static final long serialVersionUID = 1L;

  private final Icons icons;

  public DokumentArchiveUploadResultEntryStatusColumn(Messages messages, Icons icons) {
    super(messages);

    this.icons = icons;
  }

  @Override
  public ColumnType getType() {
    return ColumnType.ENUM;
  }

  @Override
  public String getHeader() {
    return getMessage("dokument.vorlage.archive.status");
  }

  @Override
  public Object getValue(DokumentArchiveUploadResultEntry dokumentArchiveUploadResultEntry) {
    return getMessage(dokumentArchiveUploadResultEntry.getStatus());
  }

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

  @Override
  public boolean isIconRendered(DokumentArchiveUploadResultEntry dokumentArchiveUploadResultEntry) {
    return true;
  }

  @Override
  public String getIcon(DokumentArchiveUploadResultEntry dokumentArchiveUploadResultEntry) {
    return dokumentArchiveUploadResultEntry.getStatus().getIcon(icons);
  }
}
