
package de.ivu.elect.business.email.entity;

import org.primefaces.model.file.UploadedFile;

import de.ivu.elect.business.datei.entity.AbstractDateiFileNames;
import de.ivu.elect.business.exchange.control.FileFormat;
import de.ivu.elect.business.wahl.entity.Wahl;
import de.ivu.elect.business.wahl.entity.Wahltermin;
import de.ivu.elect.jee.faces.Messages;

public class EmailVorgangAnhangFileNames extends AbstractDateiFileNames {

  private final String originalDateiname;

  public EmailVorgangAnhangFileNames(Messages messages, UploadedFile uploadedFile) {
    super(messages);

    this.originalDateiname = uploadedFile.getFileName();
  }

  @Override
  public String getOriginalDateiname(FileFormat fileFormat, Wahl wahl, Wahltermin wahltermin) {
    return originalDateiname;
  }

  @Override
  public String getDateiname(FileFormat fileFormat, Wahl wahl, Wahltermin wahltermin) {
    return generateUniqueFileNamePart() + DELIMITER + getOriginalDateiname(fileFormat, wahl, wahltermin);
  }
}
