/*
 * BEGIN FLOCK GPL
 *
 * Copyright Flock Inc. 2005-2009
 * http://flock.com
 *
 * This file may be used under the terms of the
 * GNU General Public License Version 2 or later (the "GPL"),
 * http://www.gnu.org/licenses/gpl.html
 *
 * 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.
 *
 * END FLOCK GPL
 */

#include "nsISupports.idl"
#include "nsIObserver.idl"
interface flockIWebServiceAccount;

[scriptable, uuid(88e9b869-1234-4be9-9f08-5881f28d392e)]
interface flockIAccountObserver : nsIObserver
{
  /**
   * Functionality to be performed when AccountService observes that an account
   * has been authenticated.
   *
   * @param aAccount (in) XPCOM Account that has been authenticated
   */
  void onAccountAuthenticated(in flockIWebServiceAccount aAccount);
  
  /**
   * Functionality to be performed when AccountService observes that an account
   * has just been unauthenticated.
   *
   * @param aAccount (in) XPCOM Account that has been unauthenticated
   */
  void onAccountUnauthenticated(in flockIWebServiceAccount aAccount);
  
  /**
   * @param aAccount (in) XPCOM Account that has started refreshing
   */
  void onAccountRefreshing(in flockIWebServiceAccount aAccount);
  
  /**
   * @param aAccount (in) XPCOM Account that has finished refreshing
   */
  void onAccountNoLongerRefreshing(in flockIWebServiceAccount aAccount);

  /**
   * @param aAccount (in) XPCOM Account that has been removed
   */
  void onAccountRemoved(in flockIWebServiceAccount aAccount);
};


[scriptable, uuid(d6844567-1258-4a92-8ecd-20b810683b78)]
interface flockIAccountService : nsISupports
{
  /**
   * Registers a given listener for a notifications regarding the specified
   * topic.
   *
   * @param aObserver (in) The interface pointer which will receive notifications.
   */
  void addObserver(in flockIAccountObserver aObserver);

  /**
   * Unregisters a given listener from notifications regarding the specified
   * topic.
   *
   * @param aObserver (in) The interface pointer which will stop receiving
   *        notifications.
   */
  void removeObserver(in flockIAccountObserver aObserver);
  
  /**
   * Tells the Account Service to send a change notification for a
   * specific account.
   *
   * @param aMethod (in) The type of change.
   * @param aAccount (in) The XPCOM account that has changed.
   */
  void notifyObservers(in AString aMethod, in flockIWebServiceAccount aAccount);
};
