package com.wechat.callback.passiveresponses;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.wechat.global.message.InfoMsg;

@XmlRootElement(name = "xml")
public final class TextResponse extends BasePassiveResponse {

    private String content;//消息内容

    /**
     * 系统出错提示
     */
    public static TextResponse SERVER_ERROR() {
        return new TextResponse(InfoMsg.ERROR_SYSTEM_ERROR.getMsg());
    }

    public TextResponse(String response) {
        super();
        setMsgType(MsgTypeEnum.TEXT);
        setContent(response);
    }

    public TextResponse() {
        super();
        setMsgType(MsgTypeEnum.TEXT);
    }

    public String getContent() {
        return content;
    }

    @XmlElement(name = "Content")
    public void setContent(String content) {
        this.content = content.replace("\\", "\\\\").replace("\"", "\\\"");
    }
}
