#ifndef PRM_LEVELSCHEME_HH
#define PRM_LEVELSCHEME_HH

#include <iostream>
#include <tuple>

#include "ParticleRotor.hh"

namespace PRM {
  class Level {
  public:
    int fSpin;
    int fIndx;      //note this is 1-indexed, while the corresponding matrices and vectors in fPartRotor are 0-indexed
    double fEnergy; //excitation energy
    int fParity;
    int fSPDom;
    int fKDom;
    int fMaxSP;
    int fMaxK;
    
    int fSPDomGlob;

    Level();
    Level(int spin, int indx, int par, double energy);
    void Print(std::ostream &out);
    void WriteDraw(std::ostream &out, std::string name);
  };
    
  class LevelScheme {
  public:
    ParticleRotor &fPartRotorPos;
    ParticleRotor &fPartRotorNeg;
    std::map<std::tuple<int, int, int>, Level> fLevels; //key 2J, indx, parity
    std::vector<std::tuple<int,int, int> > fPrintLevels;
    std::vector<std::pair<int,int> > fPosPrintLevels;
    std::vector<std::pair<int,int> > fNegPrintLevels;

    std::vector<int> fPosSPLevel; //maps between positive SP levels and global SP level indexes
    std::vector<int> fNegSPLevel; //maps between negative SP levels and global SP level indexes

    LevelScheme(ParticleRotor &protpos, ParticleRotor &protneg);
    void SetPrintLevels(int nlevels);
    void Print(std::ostream &out, int nlevels);
    void WriteDraw(std::ostream &out, int nlevels);
    void PrintAmplitudes(std::ostream &out, int nlevels);
  };
}

#endif
