/* 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 "domstubs.idl"
#include "nsIDOMContactProperties.idl"
#include "nsIDOMEventTarget.idl"
#include "nsIDOMEvent.idl"

interface nsIArray;
interface nsIDOMContactFindOptions;
interface nsIDOMContactProperties;
interface nsIDOMDOMRequest;

[scriptable, uuid(da0f7040-388b-11e1-b86c-0800200c9a66)]
interface nsIDOMContact : nsIDOMContactProperties
{
  attribute DOMString id;
  readonly attribute jsval     published;
  readonly attribute jsval     updated;

  void init(in nsIDOMContactProperties properties);  // Workaround BUG 723206
};

[scriptable, builtinclass, uuid(6ed26570-b640-11e1-afa6-0800200c9a66)]
interface nsIDOMMozContactChangeEvent : nsIDOMEvent
{
  readonly attribute DOMString contactID;
  readonly attribute DOMString reason;

  [noscript] void initMozContactChangeEvent(in DOMString aType,
                                            in boolean aCanBubble,
                                            in boolean aCancelable,
                                            in DOMString aContactID,
                                            in DOMString aReason);
};

dictionary MozContactChangeEventInit : EventInit
{
  DOMString contactID;
  DOMString reason;
};

[scriptable, uuid(d88af7e0-a45f-11e1-b3dd-0800200c9a66)]
interface nsIDOMContactManager : nsISupports
{
  nsIDOMDOMRequest find(in nsIDOMContactFindOptions options);

  nsIDOMDOMRequest clear();

  nsIDOMDOMRequest save(in nsIDOMContact contact);
  
  nsIDOMDOMRequest remove(in nsIDOMContact contact);

  nsIDOMDOMRequest getSimContacts(in DOMString type);

  attribute nsIDOMEventListener oncontactchange;
};
