/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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"
#include "nsIMsgIncomingServer.idl"
#include "nsIMsgIdentity.idl"
#include "nsISupportsArray.idl"

/**
 * An account consists of an incoming server and one or more
 * outgoing identities. An account is identified by a key,
 * which is the <account> string in the account preferences,
 * such as in mail.account.<account>.identities.
 */

[scriptable, uuid(3FE5B45D-ACF8-4348-8951-757D21E983F2)]
interface nsIMsgAccount : nsISupports {

  /**
   * Initialize an account.
   *
   * @throws NS_ERROR_ALREADY_OPENED if it is called more then once.
   */
  void init();

  /// Internal key identifying itself
  attribute ACString key;

  /// Incoming server stuff
  attribute nsIMsgIncomingServer incomingServer;

  /// Outgoing identity list (array of nsIMsgIdentity's)
  readonly attribute nsISupportsArray identities;

  /// The default identity for this account.
  attribute nsIMsgIdentity defaultIdentity;

  /// Add a new identity to this account
  void addIdentity(in nsIMsgIdentity identity);

  /// Remove an identity from this account
  void removeIdentity(in nsIMsgIdentity identity);

  /// Clear all user preferences associated with an account.
  void clearAllValues();

  /// Name in javascript
  AString toString();
};
