/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"
#include "nsIAtom.idl"

interface nsIMsgFolder;
interface nsIMsgDBHdr;

typedef unsigned long folderListenerNotifyFlagValue;

[scriptable, uuid(f60ee1a2-6d81-422c-958f-d408b1b2daa7)]
interface nsIFolderListener : nsISupports {
  const folderListenerNotifyFlagValue added = 0x1;
  void OnItemAdded(in nsIMsgFolder aParentItem,
                   in nsISupports aItem);
  
  const folderListenerNotifyFlagValue removed = 0x2;
  void OnItemRemoved(in nsIMsgFolder aParentItem,
                     in nsISupports aItem);
  
  const folderListenerNotifyFlagValue propertyChanged = 0x4;
  void OnItemPropertyChanged(in nsIMsgFolder aItem,
                             in nsIAtom aProperty,
                             in string aOldValue,
                             in string aNewValue);
  
  const folderListenerNotifyFlagValue intPropertyChanged = 0x8;
  // While this property handles long long (64bit wide) values,
  // the Javascript engine will only pass values up to 2^53 to the consumers.
  void OnItemIntPropertyChanged(in nsIMsgFolder aItem,
                                in nsIAtom aProperty,
                                in long long aOldValue,
                                in long long aNewValue);
  
  const folderListenerNotifyFlagValue boolPropertyChanged = 0x10;
  void OnItemBoolPropertyChanged(in nsIMsgFolder aItem,
                                 in nsIAtom aProperty,
                                 in boolean aOldValue,
                                 in boolean aNewValue);
  
  const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20;
  void OnItemUnicharPropertyChanged(in nsIMsgFolder aItem,
                                    in nsIAtom aProperty,
                                    in wstring aOldValue,
                                    in wstring aNewValue);
  
  const folderListenerNotifyFlagValue propertyFlagChanged = 0x40;
  void OnItemPropertyFlagChanged(in nsIMsgDBHdr aItem,
                                 in nsIAtom aProperty,
                                 in unsigned long aOldFlag,
                                 in unsigned long aNewFlag);

  const folderListenerNotifyFlagValue event = 0x80;
  void OnItemEvent(in nsIMsgFolder aItem, in nsIAtom aEvent);
  
  const folderListenerNotifyFlagValue all = 0xFFFFFFFF; 

  //  void OnFolderLoaded(in nsIMsgFolder aFolder);
  //  void OnDeleteOrMoveMessagesCompleted(in nsIMsgFolder aFolder);
};
