
/**
 *
 */
package org.tio.sitexxx.im.common.bs.wx.group;

import lombok.Data;
import org.tio.sitexxx.service.model.main.WxChatItems;
import org.tio.sitexxx.service.model.main.WxGroupMsg;

import java.io.Serializable;

/**
 * 群操作通知-- Server-->Client
 * @author xufei
 * 2020年1月19日 下午2:56:14
 */
@Data
public class WxGroupOperNtf implements Serializable {
	private static final long	serialVersionUID	= 4487525418584644680L;
	private Long				mid;										//消息id，全局唯一，一条消息一个id
	private Long				t;											//消息发送时间
	private String				c;											//聊天内容
	private Long				g					= null;					//groupid
	private Integer				uid;										//发送方的userid
	private Short				oper				= 1;					//操作码：1:删除群；2:转移群；3：被转移群
	private Long				chatlinkid			= null;					//聊天会话

	private Short	chatmode	= 2;	//会话模型
	private String	actname;			//激活时的名称
	private String	actavatar;			//激活时的头像
	private Short	grouprole;			//群角色

	private String bizdata; //业务数据

	private WxChatItems chatItems;

	public static WxGroupOperNtf from(WxGroupMsg msg) {
		WxGroupOperNtf ret = new WxGroupOperNtf();
		ret.setC(msg.getText());
		ret.setMid(msg.getId());
		ret.setG(msg.getGroupid());
		ret.setChatlinkid(-msg.getGroupid());
		ret.setT(msg.getTime().getTime());
		ret.setUid(msg.getUid());
		return ret;
	}
}
