package com.wechat.callback.passiveresponses;

import javax.xml.bind.annotation.*;

import com.wechat.common.utils.DateUtils;
import com.wechat.common.utils.StringsUtils;

/**
 * in fact, it's identical to tencentrequests.BaseRequest
 * except the MsgTypeEnum
 */
@XmlTransient
public abstract class BasePassiveResponse {
    @XmlType
    @XmlEnum(String.class)
    public static enum MsgTypeEnum {
        @XmlEnumValue("text")TEXT, //文本
        @XmlEnumValue("news")NEWS, //图文
        @XmlEnumValue("transfer_customer_service")SERVICE, //多客服
        @XmlEnumValue("image")IMAGE //图片
    }

    public final static BasePassiveResponse NULL_RESPONSE = null;

    private String ToUserName;  //用户OpenID
    private String FromUserName;//公众号
    private String CreateTime;//创建时间
    private MsgTypeEnum MsgType;//消息类型

    protected BasePassiveResponse() {
        setCreateTime(StringsUtils.parseLong(DateUtils.getCurrentDate().getTime()));
    }

    public String getToUserName() {
        return ToUserName;
    }

    @XmlElement(name = "ToUserName")
    public void setToUserName(String toUserName) {
        ToUserName = toUserName;
    }

    public String getFromUserName() {
        return FromUserName;
    }

    @XmlElement(name = "FromUserName")
    public void setFromUserName(String fromUserName) {
        FromUserName = fromUserName;
    }

    public String getCreateTime() {
        return CreateTime;
    }

    @XmlElement(name = "CreateTime")
    public void setCreateTime(String createTime) {
        CreateTime = createTime;
    }

    public MsgTypeEnum getMsgType() {
        return MsgType;
    }

    @XmlElement(name = "MsgType")
    public void setMsgType(MsgTypeEnum msgType) {
        MsgType = msgType;
    }
}
