package com.github.bot.curiosone.core.workflow;

import java.util.Objects;

/**
 * Manages a Message.
 * A Message consists of two String: one to store the content of the Message and the other one to
 * store its scope.
 * Provides all the utility methods to create, access and compare a Message.
 */
public class Message {

  /**
   * Stores the content of this Message.
   */
  String message;

  /**
   * Stores the scope of this Message.
   */
  String scope;

  /**
   * Stores the scope of this Message.
   */
  String emotion;

  /**
   * Constructs this Message from a text/content and its scope.
   * @param message Message content. Can be null.
   * @param scope Message scope. Can be null.
   * @param emotion Message emotion. Can be null.
   */
  public Message(String message, String scope, String emotion) {
    this.message = (message == null) ? "" : message;
    this.scope = (scope == null) ? "" : scope;
    this.emotion = (emotion == null) ? "" : emotion;
  }

  /**
   * Gets the content of this Message.
   */
  public String getMessage() {
    return message;
  }

  /**
   * Gets the scope of this Message.
   */
  public String getScope() {
    return scope;
  }

  /**
   * Gets the emotion of this Message.
   */
  public String getEmotion() {
    return emotion;
  }

  /**
   * Returns a String representation of this Message.
   */
  @Override
  public String toString() {
    return message + " (" + scope + ")[" + emotion + "]";
  }

  /**
   * Checks whether this Message equals to the given Object.
   * @param  other the other Message to be compared against.
   * @return {@code true} if this Message equals the other Message;
   *         {@code false} otherwise
   */
  @Override
  public boolean equals(Object other) {
    if (other == this) {
      return true;
    }
    if (other == null || other.getClass() != this.getClass()) {
      return false;
    }
    Message that = (Message) other;
    return this.message.equals(that.message)
      && this.scope.equals(that.scope)
      && this.emotion.equals(that.emotion);
  }

  /**
   * Returns the HashCode of this Message.
   * The HashCode is based on the HashCodes of the Message content and its scope.
   */
  @Override
  public int hashCode() {
    return Objects.hash(message, scope, emotion);
  }
}

@@ -610,23 +610,37 @@
  @param 
+ 
 message
+%0A   *        
  Message
@@ -674,21 +674,35 @@
  @param 
+ 
 scope
+%0A   *        
  Message
@@ -734,23 +734,37 @@
  @param 
+ 
 emotion
+%0A   *        
  Message
@@ -1022,28 +1022,32 @@
 %0A  /**%0A   * 
-Gets
+@return 
  the content
@@ -1133,28 +1133,32 @@
 %0A  /**%0A   * 
-Gets
+@return 
  the scope o
@@ -1246,12 +1246,16 @@
   * 
-Gets
+@return 
  the
@@ -1353,23 +1353,24 @@
 **%0A   * 
-R
+@r
 eturn
-s
+ 
  a Strin
@@ -1598,16 +1598,29 @@
 m  other
+%0A   *        
  the oth
@@ -1667,16 +1667,17 @@
 @return 
+ 
 %7B@code t
@@ -1723,24 +1723,25 @@
 essage;%0A   *
+ 
          %7B@c
@@ -2143,14 +2143,17 @@
   * 
-Return
+Calculate
 s th
@@ -2258,24 +2258,69 @@
  its scope.%0A
+   * @return  the HashCode of this Messagess%0A
    */%0A  @Ove

improve Message javadoc