
package de.ivu.elect.presentation.exchange;

import java.util.ArrayList;
import java.util.Collection;

import javax.inject.Inject;

import org.apache.deltaspike.core.api.scope.ConversationGroup;
import org.apache.deltaspike.core.api.scope.GroupedConversation;
import org.apache.deltaspike.core.api.scope.GroupedConversationScoped;

import de.ivu.elect.business.exchange.control.FileFormat;

@GroupedConversationScoped
@ConversationGroup(ImportDescriptionConversationStore.class)
public class ImportDescriptionConversationStore implements java.io.Serializable {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient GroupedConversation conversation;

  private ImportDescription importDescription;

  private Collection<FileFormat> importFileFormats;

  public ImportDescriptionConversationStore() {
    super();

    this.importDescription = null;
    this.importFileFormats = new ArrayList<>();
  }

  public void close() {
    importDescription = null;
    importFileFormats = new ArrayList<>();

    conversation.close();
  }

  public boolean isSelected() {
    return getImportDescription() != null;
  }

  public ImportDescription getImportDescription() {
    return importDescription;
  }

  public void setImportDescription(ImportDescription importDescription) {
    this.importDescription = importDescription;
  }

  public Collection<FileFormat> getImportFileFormats() {
    return importFileFormats;
  }

  public void setImportFileFormats(Collection<FileFormat> importFileFormats) {
    this.importFileFormats = importFileFormats;
  }
}
