package org.easywechat.msg.req;

import org.easywechat.util.MessageBuilder;

/**
 * ½ÓÊÕµ½µÄÓïÒôÏûÏ¢
 */
public final class VoiceReqMsg extends BaseReqMsg {

	private String mediaId;// ÓïÒôÏûÏ¢Ã½Ìåid£¬¿ÉÒÔµ÷ÓÃ¶àÃ½ÌåÎÄ¼þÏÂÔØ½Ó¿ÚÀ­È¡Êý¾Ý
	private String format;// ÓïÒô¸ñÊ½£¬Èçamr£¬speexµÈ

	private String recognition;// ÓïÒôÊ¶±ð½á¹û£¬UTF8±àÂë

	/**
	 * ÓïÒôÏûÏ¢Ã½Ìåid£¬¿ÉÒÔµ÷ÓÃ¶àÃ½ÌåÎÄ¼þÏÂÔØ½Ó¿ÚÀ­È¡Êý¾Ý
	 */
	public String getMediaId() {
		return mediaId;
	}

	/**
	 * µÃµ½ÓïÒô¸ñÊ½£¬Èçamr¡¢speexµÈ
	 */
	public String getFormat() {
		return format;
	}

	/**
	 * µÃµ½ÓïÒôÊ¶±ð½á¹û£¬UTF8±àÂë<br>
	 * ×¢Òâ£ºÈç¹ûÎ´¿ªÍ¨ÓïÒôÊ¶±ð½Ó¿Ú£¬Ôò·µ»Ønull
	 */
	public String getRecognition() {
		return recognition;
	}

	public VoiceReqMsg(String mediaId, String format, String recognition) {
		super();
		this.mediaId = mediaId;
		this.format = format;
		this.recognition = recognition;
		setMsgType(ReqType.VOICE);
	}

	@Override
	public String toXml() {
		MessageBuilder mb = new MessageBuilder(super.toXml());
		mb.addData("MsgType", ReqType.VOICE);
		mb.addData("MediaId", mediaId);
		mb.addData("Format", format);
		mb.addTag("MsgId", msgId);
		mb.surroundWith("xml");
		return mb.toString();
	}

	@Override
	public String toString() {
		return "VoiceReqMsg [mediaId=" + mediaId + ", format=" + format
				+ ", recognition=" + recognition + ", msgId=" + msgId
				+ ", toUserName=" + toUserName + ", fromUserName="
				+ fromUserName + ", createTime=" + createTime + ", msgType="
				+ msgType + "]";
	}

}
