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

import java.util.List;

import de.ivu.elect.jee.performance.ViewAccessTargetStatistics;
import de.ivu.elect.jee.performance.ViewType;


import static java.util.stream.Collectors.toList;

public enum PerformanceStatistikViewType {

  VIEW {
    @Override
    public String getMsgKey() {
      return "performance.statistics.unit.views";
    }
  },
  IMPORT {
    @Override
    public String getMsgKey() {
      return "performance.statistics.unit.importe";
    }
  },
  EXPORT {
    @Override
    public String getMsgKey() {
      return "performance.statistics.unit.exporte";
    }
  },
  BACKGROUND {
    @Override
    public String getMsgKey() {
      return "performance.statistics.unit.background";
    }
  },

  INTERFACE {
    @Override
    public String getMsgKey() {
      return "performance.statistics.unit.interfaces";
    }
  },
  STIMMENEINGABE {
    @Override
    public String getMsgKey() {
      return "performance.statistics.unit.stimmeneingabe";
    }
  }
  ;

  public List<ViewAccessTargetStatistics> filter(List<ViewAccessTargetStatistics> statistics) {
    ViewType viewType = ViewType.valueOf(name());
    return statistics.stream().filter(s -> viewType.equals(s.getType())).collect(toList());
  }

  public abstract String getMsgKey();
}
