// imapd/ImapdDb.hh
// This file is part of Decimail; see http://decimail.org
// (C) 2004-2007 Philip Endecott
 
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
#ifndef ImapdDb_hh
#define ImapdDb_hh

#include "DmDatabase.hh"


namespace Imapd {

class ImapdDb: public DmDatabase {

public:

  ImapdDb(void);

  // Queries used by CompleteCmd:
  pbe::ColumnQuery<std::string, std::string,int> q_get_completions;

  // Queries used by the actions framework:
  pbe::OptQuery<std::string, mailbox_name_t> q_get_create_action;
  pbe::OptQuery<std::string, mailbox_name_t> q_get_delete_action;
  pbe::OptQuery<std::string, mailbox_name_t> q_get_rename_action;
  pbe::OptQuery<std::string, mailbox_name_t> q_get_copy_action;

  // Queries used by ExpungeCmd:
  pbe::ColumnQuery<msg_id_t> q_get_deleted_messages;
  pbe::Query<>               q_create_todelete;
  pbe::Query<msg_id_t>       q_insert_todelete;
  pbe::Query<>               q_delete_todelete;

  // Queries used by ListOrLsubCmd:
  pbe::ColumnQuery<mailbox_name_t, username_t,std::string> q_get_mailbox_names;
  pbe::ColumnQuery<mailbox_name_t, username_t,std::string> q_get_subscribed_mailbox_names;

  // Queries used to create user views:
  pbe::Query<std::string> create_u_messages;
  pbe::Query<std::string> create_u_recipients;
  pbe::Query<std::string> create_u_actions;
  pbe::Query<std::string> create_u_imap_mailbox_flags;
  pbe::Query<std::string> create_u_imap_message_flags;

  void create_user_views(std::string username);
};

};


#endif
