#ifndef NLSR_CERT_STORE_HPP
#define NLSR_CERT_STORE_HPP

#include<list>
#include <ndn-cpp-dev/security/identity-certificate.hpp>
#include "nlsr_cse.hpp"
#include "nlsr_wl.hpp"

namespace nlsr
{
  class NlsrCertificateStore
  {
  public:
    NlsrCertificateStore()
        : certTable()
        , waitingList()
    {}

    bool addCertificate(NlsrCertificateStoreEntry & ncse);
    bool addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert
                        , uint32_t csn, bool isv);
    std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
                            getCertificateFromStore(const std::string certName);
    std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
           getCertificateFromStore(const std::string certName, int checkSeqNum);
    bool removeCertificateFromStroe(const std::string certName);
    bool isCertificateNewInStore(const std::string certName, int checkSeqNo);
    std::pair<uint32_t, bool> getCertificateSeqNum(std::string certName);
    void printCertStore();
    void setCertificateIsVerified(std::string certName, bool isVerified);
    bool getCertificateIsVerified(std::string certName);
  private:
    void updateWaitingList(NlsrCertificateStoreEntry& ncse);
    void updateWaitingList(std::string respCertName);
    
  private:
    std::list<NlsrCertificateStoreEntry> certTable;
    WaitingList waitingList;
  };
}

#endif
