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


#include "nsISupports.idl"
#include "nsMsgFilterCore.idl"
#include "nsIMsgSearchScopeTerm.idl"
#include "nsIMsgSearchValue.idl"
#include "nsIMsgSearchTerm.idl"

interface nsOutputStream;

[scriptable, uuid(605db0f8-04a1-11d3-a50a-0060b0fc04b7)]
interface nsIMsgFilter : nsISupports {
    readonly attribute nsMsgFilterTypeType filterType;
    attribute boolean enabled;
    attribute wstring filterName;
    attribute string filterDesc;

    readonly attribute nsIMsgFilterList filterList; // owning filter list
    
    void AddTerm(in nsMsgSearchAttribValue attrib,
                 in nsMsgSearchOpValue op,
                 in nsIMsgSearchValue value,
                 in boolean BooleanAND,
                 in string arbitraryHeader);

    void GetTerm(in long termIndex,
                 out nsMsgSearchAttribValue attrib,
                 out nsMsgSearchOpValue op,
                 out nsIMsgSearchValue value, // bad! using shared structure
                 out boolean BooleanAND,
                 out string arbitraryHeader);

    void appendTerm(in nsIMsgSearchTerm term);

    nsIMsgSearchTerm createTerm();

    // this is the actual array of search terms, and is thus modifyable
    readonly attribute nsISupportsArray searchTerms;

    attribute nsIMsgSearchScopeTerm scope;

    attribute nsMsgRuleActionType action;

    // target priority.. throws an exception if the action is not priority
    attribute nsMsgPriorityValue actionPriority;

    // target folder.. throws an exception if the action is not move to folder
    attribute string actionTargetFolderUri;

    // marking noscript because "headers" is actually a null-seperated
    // list of headers, which is not scriptable
    [noscript] void MatchHdr(in nsIMsgDBHdr msgHdr, in nsIMsgFolder folder,
                  in nsIMsgDatabase db,
                  in string headers,
                  //                  [array, size_is(headerSize)] in string headers,
                  in unsigned long headerSize, out boolean result);

    void LogRuleHit(in nsOutputStream stream, in nsIMsgDBHdr header);


};
