package de.dtele.messages.events {
  
  import de.dtele.messages.Message;
  
  import flash.events.Event;
  
  /**
   * Notification for message events
   * 
   * @author Mathias Brodala
   */
  public class MessageEvent extends Event {
    
    /* Constants */
    /**
     * The MessageEvent.ADDED constant defines the value of the 
     * <code>type</code> property of the event object 
     * for a <code>messageAdded</code> event.
     * 
     * @eventType messageAdded
     */
    public static const ADDED:String = "messageAdded";
    /**
     * The MessageEvent.REMOVED constant defines the value of the 
     * <code>type</code> property of the event object 
     * for a <code>messageRemoved</code> event.
     * 
     * @eventType messageRemoved
     */
    public static const REMOVED:String = "messageRemoved";
    /**
     * The MessageEvent.CANCELLED constant defines the value of the 
     * <code>type</code> property of the event object 
     * for a <code>messageCancelled</code> event.
     * 
     * @eventType messageCancelled
     */
    public static const CANCELLED:String = "messageCancelled";
    /**
     * The MessageEvent.DONE constant defines the value of the 
     * <code>type</code> property of the event object 
     * for a <code>messageDone</code> event.
     * 
     * @eventType messageDone
     */
    public static const DONE:String = "messageDone";
    /**
     * The MessageEvent.PROGRESS constant defines the value of the 
     * <code>type</code> property of the event object 
     * for a <code>messageProgress</code> event.
     * 
     * @eventType messageProgress
     */
    public static const PROGRESS:String = "messageProgress";
    
    /* Properties */
    private var _message:Message;
    /**
     * The message this event was triggered for
     */
    public function get message():Message { return _message; }

    /* Methods */    
    public function MessageEvent(type:String, message:Message, bubbles:Boolean=false, cancelable:Boolean=false) {
      
      super(type, bubbles, cancelable);
      this._message = message;
    }
  }
}