/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.std.server;



import java.util.SortedSet;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.types.AttributeType;



/**
 * A server-side interface for querying SMTP Account Status
 * Notification Handler settings.
 * <p>
 * The SMTP Account Status Notification Handler is a notification
 * handler that sends email messages to end users and/or administrators
 * whenever an account status notification is generated.
 */
public interface SMTPAccountStatusNotificationHandlerCfg extends AccountStatusNotificationHandlerCfg {

  /**
   * Gets the configuration class associated with this SMTP Account Status Notification Handler.
   *
   * @return Returns the configuration class associated with this SMTP Account Status Notification Handler.
   */
  Class<? extends SMTPAccountStatusNotificationHandlerCfg> configurationClass();



  /**
   * Register to be notified when this SMTP Account Status Notification Handler is changed.
   *
   * @param listener
   *          The SMTP Account Status Notification Handler configuration change listener.
   */
  void addSMTPChangeListener(ConfigurationChangeListener<SMTPAccountStatusNotificationHandlerCfg> listener);



  /**
   * Deregister an existing SMTP Account Status Notification Handler configuration change listener.
   *
   * @param listener
   *          The SMTP Account Status Notification Handler configuration change listener.
   */
  void removeSMTPChangeListener(ConfigurationChangeListener<SMTPAccountStatusNotificationHandlerCfg> listener);



  /**
   * Gets the "email-address-attribute-type" property.
   * <p>
   * Specifies which attribute in the user's entries may be used to
   * obtain the email address when notifying the end user.
   * <p>
   * You can specify more than one email address as separate values.
   * In this case, the OpenDS server sends a notification to all email
   * addresses identified.
   *
   * @return Returns an unmodifiable set containing the values of the "email-address-attribute-type" property.
   */
  SortedSet<AttributeType> getEmailAddressAttributeType();



  /**
   * Gets the "java-class" property.
   * <p>
   * Specifies the fully-qualified name of the Java class that
   * provides the SMTP Account Status Notification Handler
   * implementation.
   *
   * @return Returns the value of the "java-class" property.
   */
  String getJavaClass();



  /**
   * Gets the "message-subject" property.
   * <p>
   * Specifies the subject that should be used for email messages
   * generated by this account status notification handler.
   * <p>
   * The values for this property should begin with the name of an
   * account status notification type followed by a colon and the
   * subject that should be used for the associated notification
   * message. If an email message is generated for an account status
   * notification type for which no subject is defined, then that
   * message is given a generic subject.
   *
   * @return Returns an unmodifiable set containing the values of the "message-subject" property.
   */
  SortedSet<String> getMessageSubject();



  /**
   * Gets the "message-template-file" property.
   * <p>
   * Specifies the path to the file containing the message template to
   * generate the email notification messages.
   * <p>
   * The values for this property should begin with the name of an
   * account status notification type followed by a colon and the path
   * to the template file that should be used for that notification
   * type. If an account status notification has a notification type
   * that is not associated with a message template file, then no email
   * message is generated for that notification.
   *
   * @return Returns an unmodifiable set containing the values of the "message-template-file" property.
   */
  SortedSet<String> getMessageTemplateFile();



  /**
   * Gets the "recipient-address" property.
   * <p>
   * Specifies an email address to which notification messages are
   * sent, either instead of or in addition to the end user for whom
   * the notification has been generated.
   * <p>
   * This may be used to ensure that server administrators also
   * receive a copy of any notification messages that are generated.
   *
   * @return Returns an unmodifiable set containing the values of the "recipient-address" property.
   */
  SortedSet<String> getRecipientAddress();



  /**
   * Gets the "sender-address" property.
   * <p>
   * Specifies the email address from which the message is sent. Note
   * that this does not necessarily have to be a legitimate email
   * address.
   *
   * @return Returns the value of the "sender-address" property.
   */
  String getSenderAddress();



  /**
   * Gets the "send-message-without-end-user-address" property.
   * <p>
   * Indicates whether an email notification message should be
   * generated and sent to the set of notification recipients even if
   * the user entry does not contain any values for any of the email
   * address attributes (that is, in cases when it is not be possible
   * to notify the end user).
   * <p>
   * This is only applicable if both one or more email address
   * attribute types and one or more additional recipient addresses are
   * specified.
   *
   * @return Returns the value of the "send-message-without-end-user-address" property.
   */
  boolean isSendMessageWithoutEndUserAddress();

}
