/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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 Oracle Corporation code.
 *
 * The Initial Developer of the Original Code is
 *  Oracle Corporation
 * Portions created by the Initial Developer are Copyright (C) 2004
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Vladimir Vukicevic <vladimir.vukicevic@oracle.com>
 *
 * 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 "calIItemBase.idl"

//
// calITodo
//
// An interface for a todo item (analogous to a VTODO)
//

[scriptable, uuid(522991f2-4928-4cd2-9a02-e3071c58cf1c)]
interface calITodo : calIItemBase
{
  const long CAL_TODO_STATUS_NEEDSACTION = 4;
  const long CAL_TODO_STATUS_COMPLETED = 5;
  const long CAL_TODO_STATUS_INPROCESS = 6;

  // as per the rather broken RFC2445,

  // entryDate maps to DTSTART, which is the day
  // this todo shows up on, if set. (optional).
  //
  // dueDate maps to DUE, which is the day
  // this todo is due, if set. (optional).
  //
  // If neither DUE nor DTSTART are set, then
  // the todo appears "today" until it is completed.
  //
  // The completeDate is the date the todo was completed,
  // or null if it hasn't been completed yet.

  attribute calIDateTime entryDate;
  attribute calIDateTime dueDate;
  attribute calIDateTime completedDate;
  attribute short percentComplete;

  // A todo isCompleted if any of the following is true:
  // - percentComplete is 100, or
  // - completedDate is non-null, or
  // - status is COMPLETED.
  // Setting isCompleted to true will
  // - set percentComplete to 100, and
  // - set completedDate to the current time, if it is not already set, and
  // - set status to COMPLETED.
  // Setting isCompleted to false will remove percentComplete, completedDate,
  // and status properties.  (This returns the todo to its state at creation,
  // in terms of completion-relevant properties.)
  //
  // If you would like to take advantage of the full, confusing disaster that
  // is the RFC2445 VTODO status state space, you can feel free to set the
  // fields individually, instead of setting isCompleted directly.  (And then
  // hope that whatever else you're talking to has the same set of rules for
  // determining if something is completed or not.)
  //
  // Setting percentComplete, completedDate, or status individually does not
  // affect any of the others at present.  (E.g., setting the percentComplete
  // from 100 to 50 doesn't clear completedDate, or change status to
  // IN-PROCESS.)  It's not clear that we want any more magic than a simple
  // property to control "all complete" vs "not complete in any way".
  attribute boolean isCompleted;

  /**
   * The duration of the todo, which is defined as dueDate - entryDate.
   * Please note that null is returned if either entryDate or
   * dueDate don't exist.
   */
  readonly attribute calIDuration duration;
};

