// Path: src/main/java/com/gikk/twirk/types/TagMap.java
// public interface TagMap extends Map<String, String>{
//     //***********************************************************
// 	// 				PUBLIC
// 	//***********************************************************
// 	/**Fetches a certain field value that might have been present in the tag.
// 	 * If the field was not present in the tag, or the field's value was empty,
// 	 * this method returns <code>NULL</code>
// 	 *
// 	 * @param identifier  The fields identifier. See {@link TwitchTags}
// 	 * @return  The fields value, if there was any. <code>NULL</code> otherwise
// 	 */
// 	public String getAsString(String identifier);
// 
// 	/**Fetches a certain field value that might have been present in the tag, and
// 	 * tries to parse it into an <code>int</code>. If the field was not present in the tag,
// 	 * or the field's value was empty, this method returns <code>-1</code>
// 	 *
// 	 * @param identifier  The fields identifier. See {@link TwitchTags}
// 	 * @return  The fields value, if it was present and an int. <code>-1</code> otherwise
// 	 */
// 	public int getAsInt(String identifier);
// 
//     /**Fetches a certain field value that might have been present in the tag, and
// 	 * tries to parse it into a <code>long</code>. If the field was not present in the tag,
// 	 * or the field's value was empty, this method returns <code>-1</code>
// 	 *
// 	 * @param identifier  The fields identifier. See {@link TwitchTags}
// 	 * @return  The fields value, if it was present and a long. <code>-1</code> otherwise
// 	 */
//     long getAsLong(String identifier);
// 
// 	/**Fetches a certain field value that might have been present in the tag, and
// 	 * tries to parse it into a <code>boolean</code>. For parsing purpose, <code>1</code> is interpreted
// 	 * as <code>true</code>, anything else as <code>false</code>.
// 	 * If the field was not present in the tag, or the field's value was empty, this method returns <code>false</code>
// 	 *
// 	 * @param identifier  The fields identifier. See {@link TwitchTags}
// 	 * @return  The fields value, if it was present and could be parsed to a boolean. <code>false</code> otherwise
// 	 */
// 	public boolean getAsBoolean(String identifier);
// 
//     /**Creates a new TagMap using the default TagMap implementation.
//      *
//      * @param tag
//      * @return the default tag map
//      */
//     static TagMap getDefault(String tag){
//         return new TagMapImpl(tag);
//     }
// }
// 
// Path: src/main/java/com/gikk/twirk/types/twitchMessage/TwitchMessage.java
// public interface TwitchMessage extends AbstractEmoteMessage {
// 
// 	/**Retrieves this message's tag segment. Should always starts with a @. Note that the
// 	 * Tag segment will look vastly different for different Twitch commands, and some won't
// 	 * even have a tag.
// 	 *
// 	 * @return The tag segment, or {@code ""} if no tag was present
// 	 */
// 	public String getTag();
// 
// 	/**Retrieves the message's prefix.<br><br>
// 	 *
// 	 * A typical Twitch message looks something line this:<br>
// 	 * <code>:name!name@name.tmi.twitch.tv COMMAND #channel :message</code> <br><br>
// 	 *
// 	 * The prefix is the part before the first space. It usually only contains data about the sender of
// 	 * the message, but it might sometimes contain other information (PING messages for example just have PING as
// 	 * their prefix).<br><br>
// 	 *
// 	 * @return The messages prefix
// 	 */
// 	public String getPrefix();
// 
// 	/**Retrieves the message's command.<br>
// 	 * The command tells us what action triggered this message being sent.<br><br>
// 	 *
// 	 * @return The message's command
// 	 */
// 	public String getCommand();
// 
// 	/**Retrieves the message's target.<br>
// 	 * The target tells us whom the message is intended towards. It can be a user,
//      * a channel, or something else (though mostly the channel).
//      * <p>
// 	 * This segment is not always present.
// 	 *
// 	 * @return The message's target, or {@code ""} if no target
// 	 */
// 	public String getTarget();
// 
// 	/**Retrieves the message's content.<br>
// 	 * The content is the commands parameters. Most often, this is the actual chat message, but it may be many
// 	 * other things for other commands.<br><br>
// 	 *
// 	 * This segment is not always present.
// 	 *
// 	 * @return The message's content, or {@code ""} if no content
// 	 */
// 	public String getContent();
// 
//     /**Tells whether this message was a cheer event or not.
//      *
//      * @return {@code true} if the message contains bits, <code>false</code> otherwise
//      */
//     public boolean isCheer();
// 
//     /**Fetches a list of all all cheers in this message. Each cheer is encapsulated in a {@link Cheer}.
// 	 * The list might be empty, if the message contained no cheers.
//      *
// 	 * @return List of emotes (might be empty)
// 	 */
//     public List<Cheer> getCheers();
// 
//     /**Fetches the total number of bits that this message contained.
//      * This method is short-hand for:
//      * <pre>
//      * int bits = 0;
//      * for(Cheer c : getCheers())
//      *      bits += c.getBits();
//      * return bits;
//      * </pre>
//      * @return number of bits
//      */
//     public int getBits();
// 
//     /**Fetches the {@link TagMap} that has parsed the message's tag into a key-value map.
//      * For a list of different identifiers that can occur in a tag, check the {@link TwitchTags} class.
//      */
//     public TagMap getTagMap();
// }


import com.gikk.twirk.types.TagMap;
import com.gikk.twirk.types.twitchMessage.TwitchMessage;
package com.gikk.twirk.types.clearMsg;


class DefaultClearMsgBuilder implements ClearMsgBuilder{
	String sender;
	String msgId;
	String msgContents;
	String rawLine;

	@Override
	public ClearMsg build(TwitchMessage twitchMessage) {
		this.rawLine = twitchMessage.getRaw();
	
		TagMap r = twitchMessage.getTagMap();
		
		this.msgContents = twitchMessage.getContent();
// Path: src/main/java/com/gikk/twirk/types/TagMap.java
// public interface TagMap extends Map<String, String>{
//     //***********************************************************
// 	// 				PUBLIC
// 	//***********************************************************
// 	/**Fetches a certain field value that might have been present in the tag.
// 	 * If the field was not present in the tag, or the field's value was empty,
// 	 * this method returns <code>NULL</code>
// 	 *
// 	 * @param identifier  The fields identifier. See {@link TwitchTags}
// 	 * @return  The fields value, if there was any. <code>NULL</code> otherwise
// 	 */
// 	public String getAsString(String identifier);
// 
// 	/**Fetches a certain field value that might have been present in the tag, and
// 	 * tries to parse it into an <code>int</code>. If the field was not present in the tag,
// 	 * or the field's value was empty, this method returns <code>-1</code>
// 	 *
// 	 * @param identifier  The fields identifier. See {@link TwitchTags}
// 	 * @return  The fields value, if it was present and an int. <code>-1</code> otherwise
// 	 */
// 	public int getAsInt(String identifier);
// 
//     /**Fetches a certain field value that might have been present in the tag, and
// 	 * tries to parse it into a <code>long</code>. If the field was not present in the tag,
// 	 * or the field's value was empty, this method returns <code>-1</code>
// 	 *
// 	 * @param identifier  The fields identifier. See {@link TwitchTags}
// 	 * @return  The fields value, if it was present and a long. <code>-1</code> otherwise
// 	 */
//     long getAsLong(String identifier);
// 
// 	/**Fetches a certain field value that might have been present in the tag, and
// 	 * tries to parse it into a <code>boolean</code>. For parsing purpose, <code>1</code> is interpreted
// 	 * as <code>true</code>, anything else as <code>false</code>.
// 	 * If the field was not present in the tag, or the field's value was empty, this method returns <code>false</code>
// 	 *
// 	 * @param identifier  The fields identifier. See {@link TwitchTags}
// 	 * @return  The fields value, if it was present and could be parsed to a boolean. <code>false</code> otherwise
// 	 */
// 	public boolean getAsBoolean(String identifier);
// 
//     /**Creates a new TagMap using the default TagMap implementation.
//      *
//      * @param tag
//      * @return the default tag map
//      */
//     static TagMap getDefault(String tag){
//         return new TagMapImpl(tag);
//     }
// }
// 
// Path: src/main/java/com/gikk/twirk/types/twitchMessage/TwitchMessage.java
// public interface TwitchMessage extends AbstractEmoteMessage {
// 
// 	/**Retrieves this message's tag segment. Should always starts with a @. Note that the
// 	 * Tag segment will look vastly different for different Twitch commands, and some won't
// 	 * even have a tag.
// 	 *
// 	 * @return The tag segment, or {@code ""} if no tag was present
// 	 */
// 	public String getTag();
// 
// 	/**Retrieves the message's prefix.<br><br>
// 	 *
// 	 * A typical Twitch message looks something line this:<br>
// 	 * <code>:name!name@name.tmi.twitch.tv COMMAND #channel :message</code> <br><br>
// 	 *
// 	 * The prefix is the part before the first space. It usually only contains data about the sender of
// 	 * the message, but it might sometimes contain other information (PING messages for example just have PING as
// 	 * their prefix).<br><br>
// 	 *
// 	 * @return The messages prefix
// 	 */
// 	public String getPrefix();
// 
// 	/**Retrieves the message's command.<br>
// 	 * The command tells us what action triggered this message being sent.<br><br>
// 	 *
// 	 * @return The message's command
// 	 */
// 	public String getCommand();
// 
// 	/**Retrieves the message's target.<br>
// 	 * The target tells us whom the message is intended towards. It can be a user,
//      * a channel, or something else (though mostly the channel).
//      * <p>
// 	 * This segment is not always present.
// 	 *
// 	 * @return The message's target, or {@code ""} if no target
// 	 */
// 	public String getTarget();
// 
// 	/**Retrieves the message's content.<br>
// 	 * The content is the commands parameters. Most often, this is the actual chat message, but it may be many
// 	 * other things for other commands.<br><br>
// 	 *
// 	 * This segment is not always present.
// 	 *
// 	 * @return The message's content, or {@code ""} if no content
// 	 */
// 	public String getContent();
// 
//     /**Tells whether this message was a cheer event or not.
//      *
//      * @return {@code true} if the message contains bits, <code>false</code> otherwise
//      */
//     public boolean isCheer();
// 
//     /**Fetches a list of all all cheers in this message. Each cheer is encapsulated in a {@link Cheer}.
// 	 * The list might be empty, if the message contained no cheers.
//      *
// 	 * @return List of emotes (might be empty)
// 	 */
//     public List<Cheer> getCheers();
// 
//     /**Fetches the total number of bits that this message contained.
//      * This method is short-hand for:
//      * <pre>
//      * int bits = 0;
//      * for(Cheer c : getCheers())
//      *      bits += c.getBits();
//      * return bits;
//      * </pre>
//      * @return number of bits
//      */
//     public int getBits();
// 
//     /**Fetches the {@link TagMap} that has parsed the message's tag into a key-value map.
//      * For a list of different identifiers that can occur in a tag, check the {@link TwitchTags} class.
//      */
//     public TagMap getTagMap();
// }


// Path: src/main/java/com/gikk/twirk/types/clearMsg/DefaultClearMsgBuilder.java
import com.gikk.twirk.types.TagMap;
import com.gikk.twirk.types.twitchMessage.TwitchMessage;

package com.gikk.twirk.types.clearMsg;


class DefaultClearMsgBuilder implements ClearMsgBuilder{
	String sender;
	String msgId;
	String msgContents;
	String rawLine;

	@Override
	public ClearMsg build(TwitchMessage twitchMessage) {
		this.rawLine = twitchMessage.getRaw();
	
		TagMap r = twitchMessage.getTagMap();
		
		this.msgContents = twitchMessage.getContent();
		this.msgId = r.getAsString("target-msg-id");