/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 *
 * The contents of this file are subject to the Netscape Public License
 * Version 1.0 (the "NPL"); you may not use this file except in
 * compliance with the NPL.  You may obtain a copy of the NPL at
 * http://www.mozilla.org/NPL/
 *
 * Software distributed under the NPL is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
 * for the specific language governing rights and limitations under the
 * NPL.
 *
 * The Initial Developer of this code under the NPL is Netscape
 * Communications Corporation.  Portions created by Netscape are
 * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
 * Reserved.
 */
 
#include "nsISupports.idl"
#include "nsIFolder.idl"
#include "nsIMsgThread.idl"
#include "nsIMsgIncomingServer.idl"
#include "nsIFileSpec.idl"
#include "nsISupportsArray.idl"

%{ C++
#include "nsIMessage.h"
#include "nsITransactionManager.h"
#include "nsIMsgDatabase.h"
#include "nsMsgKeyArray.h"
%}

interface nsIMessage;
interface nsITransactionManager;
interface nsIMsgDatabase;
interface nsMsgKeyArray;

[scriptable, uuid(85e39ff0-b248-11d2-b7ef-00805f05ffa5)]
interface nsIMsgFolder : nsIFolder {

  /* already exists in nsIFolder */
  /*	readonly attribute string name;   */
  /*	void SetName(in string name); */


  /* XXX should these 2 go on nsIFolder or nsICollection? */
  void AddUnique(in nsISupports element);
  void ReplaceElement(in nsISupports element, in nsISupports newElement);
  
	nsIEnumerator GetMessages();
	nsIEnumerator GetThreads();
	nsIMsgThread GetThreadForMessage(in nsIMessage message);
	boolean HasMessage(in nsIMessage message);
  nsIEnumerator GetVisibleSubFolders();
	attribute wstring prettyName;
	readonly attribute wstring prettiestName;
	string BuildFolderURL();

	readonly attribute boolean deleteIsMoveToTrash;
	readonly attribute boolean showDeletedMessages;

  readonly attribute nsIMsgIncomingServer server;
  
	void OnCloseFolder ();
	void Delete ();

	void DeleteSubFolders(in nsISupportsArray folders);
	void PropagateDelete(in nsIMsgFolder folder, in boolean deleteStorage);
	void RecursiveDelete(in boolean deleteStorage);

	void CreateSubfolder(in string folderName);

	void Rename(in string name);
	void Adopt(in nsIMsgFolder srcFolder, out unsigned long outPos);

	boolean ContainsChildNamed(in string name);
	boolean IsAncestorOf(in nsIMsgFolder folder);

	string GenerateUniqueSubfolderName(in string prefix, in nsIMsgFolder otherFolder);

	attribute unsigned long depth;

	void UpdateSummaryTotals();
	void SummaryChanged();
	long GetNumUnread(in boolean deep);
	long GetTotalMessages(in boolean deep);

	readonly attribute unsigned long expungedBytesCount;
	readonly attribute boolean deletable;
	readonly attribute boolean canCreateChildren;
	readonly attribute boolean canBeRenamed;
	readonly attribute boolean requiresCleanup;

	void ClearRequiresCleanup();

	readonly attribute boolean knowsSearchNntpExtension;
	readonly attribute boolean allowsPosting;

	boolean DisplayRecipients();

	readonly attribute string relativePathName;
	readonly attribute unsigned long sizeOnDisk;

	void RememberPassword(in string password);
	string GetRememberedPassword();
	boolean UserNeedsToAuthenticateForFolder(in boolean displayOnly);
	string GetUsername();
	string GetHostname();

  
	void SetFlag(in unsigned long flag);
	void ClearFlag(in unsigned long flag);
	boolean GetFlag(in unsigned long flag);

	void ToggleFlag (in unsigned long flag);
	void OnFlagChange (in unsigned long flag);
	unsigned long GetFlags();

	void GetFoldersWithFlag(in unsigned long flags, out nsIMsgFolder result,
                         in unsigned long resultsize, out unsigned long numFolders);

	void GetExpansionArray(in nsISupportsArray expansionArray);

	void DeleteMessages(in nsISupportsArray message, in nsITransactionManager
                      txnMgr,in boolean deleteStorage);

  void CopyMessages(in nsIMsgFolder srcFolder, in nsISupportsArray messages,
                    in boolean isMove, in nsITransactionManager txnMgr);

  void CopyFileMessage(in nsIFileSpec fileSpec, in nsIMessage msgToReplace,
                       in boolean isDraft, in nsISupports aSupport, 
                       in nsITransactionManager txnMgr);

  void AcquireSemaphore (in nsISupports semHolder);
  void ReleaseSemaphore (in nsISupports semHolder);
  boolean TestSemaphore (in nsISupports semHolder);
  boolean IsLocked();

	nsIMessage CreateMessageFromMsgDBHdr(in nsIMsgDBHdr msgDBHdr);
	void GetNewMessages();
	attribute wstring charset;
	attribute unsigned long BiffState;
	attribute long NumNewMessages;

	readonly attribute wstring NewMessagesNotificationDescription;
	readonly attribute nsIMsgFolder RootFolder;
  readonly attribute nsIMsgDatabase msgDatabase;

	readonly attribute nsIFileSpec Path;
};


[scriptable, uuid(27D2DE40-BAF1-11d2-9578-00805F8AC615)]
interface nsIMsgLocalMailFolder : nsISupports {

};

[scriptable, uuid(3716abe4-f6d4-11d2-86d5-004005263078)]
interface nsIMsgNewsFolder : nsISupports {
  attribute string unreadSetStr;
};

[scriptable, uuid(FBFEBE79-C1DD-11d2-8A40-0060B0FC04D2)]
interface nsIMsgImapMailFolder : nsISupports {
};


