#include<string>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<limits>

#include "nlsr.hpp"
#include "nlsr_lsa.hpp"
#include "nlsr_npl.hpp"
#include "nlsr_adjacent.hpp"
#include "utility/nlsr_tokenizer.hpp"


namespace nlsr
{

  using namespace std;


  string
  NameLsa::getNameLsaKey()
  {
    string key;
    key=origRouter + "/" + boost::lexical_cast<std::string>(1);
    return key;
  }

  NameLsa::NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, Npl npl)
  {
    origRouter=origR;
    lsType=lst;
    lsSeqNo=lsn;
    lifeTime=lt;
    std::list<string> nl=npl.getNameList();
    for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++)
    {
      addNameToLsa((*it));
    }
  }

  string
  NameLsa::getNameLsaData()
  {
    string nameLsaData;
    nameLsaData=origRouter + "|" + boost::lexical_cast<std::string>(1) + "|"
                + boost::lexical_cast<std::string>(lsSeqNo) + "|"
                + boost::lexical_cast<std::string>(lifeTime);
    nameLsaData+="|";
    nameLsaData+=boost::lexical_cast<std::string>(npl.getNplSize());
    std::list<string> nl=npl.getNameList();
    for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++)
    {
      nameLsaData+="|";
      nameLsaData+=(*it);
    }
    return nameLsaData+"|";
  }

  bool
  NameLsa::initNameLsaFromContent(string content)
  {
    uint32_t numName=0;
    nlsrTokenizer nt(content, "|");
    origRouter=nt.getNextToken();
    if(origRouter.empty())
    {
      return false;
    }
    try
    {
      lsType=boost::lexical_cast<uint8_t>(nt.getNextToken());
      lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken());
      lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken());
      numName=boost::lexical_cast<uint32_t>(nt.getNextToken());
    }
    catch(std::exception &e)
    {
      return false;
    }
    for(int i=0; i<numName; i++)
    {
      string name=nt.getNextToken();
      addNameToLsa(name);
    }
    return true;
  }

  std::ostream&
  operator<<(std::ostream& os, NameLsa& nLsa)
  {
    os<<"Name Lsa: "<<endl;
    os<<"  Origination Router: "<<nLsa.getOrigRouter()<<endl;
    os<<"  Ls Type: "<<(unsigned short)nLsa.getLsType()<<endl;
    os<<"  Ls Seq No: "<<(unsigned int)nLsa.getLsSeqNo()<<endl;
    os<<"  Ls Lifetime: "<<(unsigned int)nLsa.getLifeTime()<<endl;
    os<<"  Names: "<<endl;
    int i=1;
    std::list<string> nl=nLsa.getNpl().getNameList();
    for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++)
    {
      os<<"    Name "<<i<<": "<<(*it)<<endl;
    }
    return os;
  }



  CorLsa::CorLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt
                 , double r, double theta)
  {
    origRouter=origR;
    lsType=lst;
    lsSeqNo=lsn;
    lifeTime=lt;
    corRad=r;
    corTheta=theta;
  }

  string
  CorLsa::getCorLsaKey()
  {
    string key;
    key=origRouter + "/" + boost::lexical_cast<std::string>(3);
    return key;
  }

  bool
  CorLsa::isLsaContentEqual(CorLsa& clsa)
  {
    return (std::abs(corRad - clsa.getCorRadius()) <
            std::numeric_limits<double>::epsilon()) &&
           (std::abs(corTheta - clsa.getCorTheta()) <
            std::numeric_limits<double>::epsilon());
  }

  string
  CorLsa::getCorLsaData()
  {
    string corLsaData;
    corLsaData=origRouter + "|";
    corLsaData+=(boost::lexical_cast<std::string>(3) + "|");
    corLsaData+=(boost::lexical_cast<std::string>(lsSeqNo) + "|");
    corLsaData+=(boost::lexical_cast<std::string>(lifeTime) + "|");
    corLsaData+=(boost::lexical_cast<std::string>(corRad) + "|");
    corLsaData+=(boost::lexical_cast<std::string>(corTheta) + "|");
    return corLsaData;
  }

  bool
  CorLsa::initCorLsaFromContent(string content)
  {
    nlsrTokenizer nt(content, "|");
    origRouter=nt.getNextToken();
    if(origRouter.empty())
    {
      return false;
    }
    try
    {
      lsType=boost::lexical_cast<uint8_t>(nt.getNextToken());
      lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken());
      lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken());
      corRad=boost::lexical_cast<double>(nt.getNextToken());
      corTheta=boost::lexical_cast<double>(nt.getNextToken());
    }
    catch(std::exception &e)
    {
      return false;
    }
    return true;
  }

  std::ostream&
  operator<<(std::ostream& os, CorLsa& cLsa)
  {
    os<<"Cor Lsa: "<<endl;
    os<<"  Origination Router: "<<cLsa.getOrigRouter()<<endl;
    os<<"  Ls Type: "<<(unsigned short)cLsa.getLsType()<<endl;
    os<<"  Ls Seq No: "<<(unsigned int)cLsa.getLsSeqNo()<<endl;
    os<<"  Ls Lifetime: "<<(unsigned int)cLsa.getLifeTime()<<endl;
    os<<"    Hyperbolic Radius: "<<cLsa.getCorRadius()<<endl;
    os<<"    Hyperbolic Theta: "<<cLsa.getCorTheta()<<endl;
    return os;
  }


  AdjLsa::AdjLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt,
                 uint32_t nl ,Adl padl)
  {
    origRouter=origR;
    lsType=lst;
    lsSeqNo=lsn;
    lifeTime=lt;
    noLink=nl;
    std::list<Adjacent> al=padl.getAdjList();
    for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++)
    {
      if((*it).getStatus()==1)
      {
        addAdjacentToLsa((*it));
      }
    }
  }

  string
  AdjLsa::getAdjLsaKey()
  {
    string key;
    key=origRouter + "/" + boost::lexical_cast<std::string>(2);
    return key;
  }

  bool
  AdjLsa::isLsaContentEqual(AdjLsa& alsa)
  {
    return adl.isAdlEqual(alsa.getAdl());
  }


  string
  AdjLsa::getAdjLsaData()
  {
    string adjLsaData;
    adjLsaData=origRouter + "|" + boost::lexical_cast<std::string>(2) + "|"
               + boost::lexical_cast<std::string>(lsSeqNo) + "|"
               + boost::lexical_cast<std::string>(lifeTime);
    adjLsaData+="|";
    adjLsaData+=boost::lexical_cast<std::string>(adl.getAdlSize());
    std::list<Adjacent> al=adl.getAdjList();
    for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++)
    {
      adjLsaData+="|";
      adjLsaData+=(*it).getAdjacentName();
      adjLsaData+="|";
      adjLsaData+=boost::lexical_cast<std::string>((*it).getConnectingFace());
      adjLsaData+="|";
      adjLsaData+=boost::lexical_cast<std::string>((*it).getLinkCost());
    }
    return adjLsaData+"|";
  }

  bool
  AdjLsa::initAdjLsaFromContent(string content)
  {
    uint32_t numLink=0;
    nlsrTokenizer nt(content, "|");
    origRouter=nt.getNextToken();
    if(origRouter.empty())
    {
      return false;
    }
    try
    {
      lsType=boost::lexical_cast<uint8_t>(nt.getNextToken());
      lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken());
      lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken());
      numLink=boost::lexical_cast<uint32_t>(nt.getNextToken());
    }
    catch(std::exception &e)
    {
      return false;
    }
    for(int i=0; i< numLink; i++)
    {
      try
      {
        string adjName=nt.getNextToken();
        int connectingFace=boost::lexical_cast<int>(nt.getNextToken());
        double linkCost=boost::lexical_cast<double>(nt.getNextToken());
        Adjacent adjacent(adjName, connectingFace, linkCost, 0, 0);
        addAdjacentToLsa(adjacent);
      }
      catch( std::exception &e )
      {
        return false;
      }
    }
    return true;
  }


  void
  AdjLsa::addNptEntriesForAdjLsa(Nlsr& pnlsr)
  {
    if ( getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() )
    {
      pnlsr.getNpt().addNpteByDestName(getOrigRouter(), getOrigRouter(),pnlsr);
    }
  }


  void
  AdjLsa::removeNptEntriesForAdjLsa(Nlsr& pnlsr)
  {
    if ( getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() )
    {
      pnlsr.getNpt().removeNpte(getOrigRouter(), getOrigRouter(),pnlsr);
    }
  }



  std::ostream&
  operator<<(std::ostream& os, AdjLsa& aLsa)
  {
    os<<"Adj Lsa: "<<endl;
    os<<"  Origination Router: "<<aLsa.getOrigRouter()<<endl;
    os<<"  Ls Type: "<<(unsigned short)aLsa.getLsType()<<endl;
    os<<"  Ls Seq No: "<<(unsigned int)aLsa.getLsSeqNo()<<endl;
    os<<"  Ls Lifetime: "<<(unsigned int)aLsa.getLifeTime()<<endl;
    os<<"  No Link: "<<(unsigned int)aLsa.getNoLink()<<endl;
    os<<"  Adjacents: "<<endl;
    int i=1;
    std::list<Adjacent> al=aLsa.getAdl().getAdjList();
    for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++)
    {
      os<<"    Adjacent "<<i<<": "<<endl;
      os<<"      Adjacent Name: "<<(*it).getAdjacentName()<<endl;
      os<<"      Connecting Face: "<<(*it).getConnectingFace()<<endl;
      os<<"      Link Cost: "<<(*it).getLinkCost()<<endl;
    }
    return os;
  }

}//namespace nlsr
