#ifndef MONMEMTTCONSISTENCYDAT_H
#define MONMEMTTCONSISTENCYDAT_H

#include <map>
#include <stdexcept>

#include "OnlineDB/EcalCondDB/interface/IDataItem.h"
#include "OnlineDB/EcalCondDB/interface/MonRunTag.h"
#include "OnlineDB/EcalCondDB/interface/MonRunIOV.h"
#include "OnlineDB/EcalCondDB/interface/EcalLogicID.h"

class MonMemTTConsistencyDat : public IDataItem {
public:
  friend class EcalCondDBInterface;
  MonMemTTConsistencyDat();
  ~MonMemTTConsistencyDat() override;

  // User data methods
  inline std::string getTable() override { return "MON_MEM_TT_CONSISTENCY_DAT"; }

  inline void setProcessedEvents(int proc) { m_processedEvents = proc; }
  inline int getProcessedEvents() const { return m_processedEvents; }

  inline void setProblematicEvents(int prob) { m_problematicEvents = prob; }
  inline int getProblematicEvents() const { return m_problematicEvents; }

  inline void setProblemsID(int id) { m_problemsID = id; }
  inline int getProblemsID() const { return m_problemsID; }

  inline void setProblemsSize(int size) { m_problemsSize = size; }
  inline int getProblemsSize() const { return m_problemsSize; }

  inline void setProblemsLV1(int LV1) { m_problemsLV1 = LV1; }
  inline int getProblemsLV1() const { return m_problemsLV1; }

  inline void setProblemsBunchX(int bunchX) { m_problemsBunchX = bunchX; }
  inline int getProblemsBunchX() const { return m_problemsBunchX; }

  inline void setTaskStatus(bool status) { m_taskStatus = status; }
  inline bool getTaskStatus() const { return m_taskStatus; }

private:
  void prepareWrite() noexcept(false) override;

  void writeDB(const EcalLogicID* ecid, const MonMemTTConsistencyDat* item, MonRunIOV* iov) noexcept(false);

  void writeArrayDB(const std::map<EcalLogicID, MonMemTTConsistencyDat>* data, MonRunIOV* iov) noexcept(false);

  void fetchData(std::map<EcalLogicID, MonMemTTConsistencyDat>* fillVec, MonRunIOV* iov) noexcept(false);

  // User data
  int m_processedEvents;
  int m_problematicEvents;
  int m_problemsID;
  int m_problemsSize;
  int m_problemsLV1;
  int m_problemsBunchX;
  bool m_taskStatus;
};

#endif
