/* -*- Mode: idl; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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"

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(7539c158-c30d-41d0-90e9-41d315ac3eb1)]
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 boolean isSend;

    /**
     * Attribute: sender - set to the email address of the sender if part of an
     * iMIP communication.
     */
    attribute AUTF8String sender;

    /**
     * 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);

    /**
     * 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);
};
