/* -*- Mode: idl; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla 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/MPL/
 *
 * 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 Lightning code.
 *
 * The Initial Developer of the Original Code is Simdesk Technologies Inc.
 * Portions created by the Initial Developer are Copyright (C) 2006
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Clint Talbert <ctalbert.moz@gmail.com>
 *   Matthew Willis <lilmatt@mozilla.com>
 *   Philipp Kewisch <mozilla@kewis.ch>
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "nsISupports.idl"

interface calIItemBase;
interface calICalendar;
interface nsISimpleEnumerator;

/** 
 * calIItipItem is an interface used to carry information between the mime
 * parser, the imip-bar UI, and the iTIP processor. It encapsulates a list of
 * calIItemBase objects and provides specialized iTIP methods for those items.
 */
[scriptable, uuid(f41392ab-dcad-4bad-818f-b3d1631c4d93)]
interface calIItipItem : nsISupports
{
    /**
     * Initializes the item with an ics string
     * @param - in parameter - AString of ical Data
     */
    void init(in  AUTF8String icalData);

    /**
     * Creates a new calItipItem with the same attributes as the one that
     * clone() is called upon.
     */
    calIItipItem clone();

    /**
     * Attribute: isSend - set to TRUE when sending this item to initiate an
     * iMIP communication. This will be used by the iTIP processor to route
     * the item directly to the email subsystem so that communication can be
     * initiated. For example, if you are Sending a REQUEST, you would set
     * this flag, and send the iTIP Item into the iTIP processor, which would
     * handle everything else.
     */
    attribute PRBool isSend;

    /**
     * Attribute: receivedMethod - method the iTIP item had upon reciept
     */
    attribute AUTF8String receivedMethod;

    /**
     * Attribute: responseMethod - method that the protocol handler (or the
     * user) decides to use to respond to the iTIP item (could be COUNTER,
     * REPLY, DECLINECOUNTER, etc)
     */
    attribute AUTF8String responseMethod;

    /**
     * Attribute: autoResponse Set to one of the three constants below
     */
    attribute unsigned long autoResponse;

    /**
     * Used to tell the iTIP processor to use an automatic response when
     * handling this iTIP item
     */
    const unsigned long AUTO = 0;

    /**
     * Used to tell the iTIP processor to allow the user to edit the response
     */
    const unsigned long USER = 1;

    /**
     * Used to tell the iTIP processor not to respond at all.
     */
    const unsigned long NONE = 2;

    /**
     * Attribute: targetCalendar - the calendar that this thing should be
     * stored in, if it should be stored onto a calendar. This is a calendar ID
     */
    attribute calICalendar targetCalendar;

    /**
     * The identity this item was received on. Helps to determine which
     * attendee to manipulate. This should be the full email address of the
     * attendee that is considered to be the local user.
     */
    attribute AUTF8String identity;

    /**
     * localStatus: The response that the user has made to the invitation in
     *              this ItipItem.
     */
    attribute AUTF8String localStatus;

    /**
     * Get the list of items that are encapsulated in this calIItipItem
     * @returns An array of calIItemBase items that are inside this
     *          calIItipItem
     */
    void getItemList(out unsigned long itemCount,
                     [retval, array, size_is(itemCount)] out calIItemBase items);

    /**
     * Get the first item from the iTIP message
     * Bug XXX 351761: Need to find a way to make this use an nsISimpleEnumerator
     * @return calIItemBase
     
    calIItemBase getFirstItem();
*/
    /**
     * Get next item from the iTIP message. If there is no next item then it
     * returns NULL
     * @return calIItemBase
     
    calIItemBase getNextItem();
*/
    /**
     * Modifies a calIItemBase that is in the component list. Internally, the
     * interface will update the proper component. It does this via the
     * UID of the component by calling hasSameIds().
     * @param in parameter - item to modify
     * @return returns the new calIItemBase object for convienence
     */
    calIItemBase modifyItem(in calIItemBase item);

    /**
     * Modifies the state of the given attendee in the item's ics
     * @param attendeeId - AString containing attendee address
     * @param status - AString containing the new attendee status
     */
    void setAttendeeStatus(in AString attendeeId, in AString status);
};
