/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2013, Regents of the University of California
 *                     Yingdi Yu
 *
 * BSD license, See the LICENSE file for more information
 *
 * Author: Yingdi Yu <yingdi@cs.ucla.edu>
 */


#ifndef BROWSECONTACTDIALOG_H
#define BROWSECONTACTDIALOG_H

#include <QDialog>
#include <QStringListModel>
#include <QCloseEvent>
#include "warningdialog.h"


#ifndef Q_MOC_RUN
#include <ndn-cpp-dev/security/identity-certificate.hpp>
#include <boost/thread/locks.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include "profile.h"
#include "contact-manager.h"
#endif

namespace Ui {
class BrowseContactDialog;
}

class BrowseContactDialog : public QDialog
{
  Q_OBJECT
  
public:
  explicit BrowseContactDialog(ndn::ptr_lib::shared_ptr<ContactManager> contactManager,
                               QWidget *parent = 0);

  ~BrowseContactDialog();

protected:
  typedef boost::recursive_mutex RecLock;
  typedef boost::unique_lock<RecLock> UniqueRecLock;

private:
  void
  getCertNames(std::vector<std::string> &names);

  void
  updateCertificateMap(bool filter = false);

  void
  updateCertificateFetchingStatus(int count);

  void
  fetchCertificate();

protected:
  void
  closeEvent(QCloseEvent *e);

private slots:
  void
  updateSelection(const QItemSelection &selected,
                  const QItemSelection &deselected);

  void
  onCertificateFetched(const ndn::IdentityCertificate& identityCertificate);

  void
  onCertificateFetchFailed(const ndn::Name& identity);

  void
  onWarning(QString msg);

  void
  onAddClicked();

  void
  onDirectAddClicked();

public slots:
  void
  refreshList();

signals:
  void
  newContactAdded();

  void
  directAddClicked();

private:
  Ui::BrowseContactDialog *ui;
  
  ndn::ptr_lib::shared_ptr<ContactManager> m_contactManager;

  WarningDialog* m_warningDialog;
  QStringListModel* m_contactListModel;

  QStringList m_contactList;  
  std::vector<ndn::Name> m_contactNameList;
  std::vector<ndn::Name> m_certificateNameList;
  std::map<ndn::Name, ndn::IdentityCertificate> m_certificateMap;
  std::map<ndn::Name, Profile> m_profileMap;

  RecLock m_mutex;


};

#endif // BROWSECONTACTDIALOG_H
