/* 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 "nsIDOMEventTarget.idl"

interface nsIDOMEventListener;
interface nsIDOMMozSmsFilter;
interface nsIDOMMozSmsSegmentInfo;
interface nsIDOMDOMCursor;
interface nsIDOMDOMRequest;
interface nsIDOMBlob;

[scriptable, builtinclass, uuid(8ec8247d-3f5f-41af-9c72-9dc857e3be81)]
interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget
{
  nsIDOMDOMRequest getSegmentInfoForText(in DOMString text);


  /**
   * Function to send SMS.
   *
   * @param number
   *        Either a DOMString (only one number) or an array of numbers.
   * @param message
   *        The text message to be sent.
   * @param sendParameters
   *        An SmsSendParameters object.
   * @param return
   *        A DOMRequest object indicating the sending result if one number
   *        has been passed; an array of DOMRequest objects otherwise.
   */
  [implicit_jscontext, optional_argc]
  jsval send(in jsval number, in DOMString message,
             [optional] in jsval sendParameters);

  /**
   * Function to send MMS.
   *
   * @param parameters
   *        An MmsParameters object.
   * @param sendParameters
   *        An MmsSendParameters object.
   * @param return
   *        A DOMRequest object indicating the sending result.
   */
  [implicit_jscontext, optional_argc]
  nsIDOMDOMRequest sendMMS(in jsval parameters,
                           [optional] in jsval sendParameters);

  [binaryname(GetMessageMoz)]
  nsIDOMDOMRequest getMessage(in long id);

  // The parameter can be either a message id or a nsIDOMMoz{Mms,Sms}Message.
  [implicit_jscontext]
  nsIDOMDOMRequest delete(in jsval param);

  // Iterates through nsIDOMMoz{Mms,Sms}Message.
  nsIDOMDOMCursor getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);

  nsIDOMDOMRequest markMessageRead(in long id, in boolean value,
                                   [optional] in boolean aSendReadReport);

  // Iterates through nsIDOMMozMobileMessageThread.
  nsIDOMDOMCursor getThreads();

  nsIDOMDOMRequest retrieveMMS(in long id);

  [optional_argc]
  nsIDOMDOMRequest getSmscAddress([optional] in unsigned long serviceId);

  [implicit_jscontext] attribute jsval onreceived;
  [implicit_jscontext] attribute jsval onretrieving;
  [implicit_jscontext] attribute jsval onsending;
  [implicit_jscontext] attribute jsval onsent;
  [implicit_jscontext] attribute jsval onfailed;
  [implicit_jscontext] attribute jsval ondeliverysuccess;
  [implicit_jscontext] attribute jsval ondeliveryerror;
  [implicit_jscontext] attribute jsval onreadsuccess;
  [implicit_jscontext] attribute jsval onreaderror;
  [implicit_jscontext] attribute jsval ondeleted;
};
