package com.zt.plat.module.qms.iot.tcpserver.core;

import lombok.Data;

import java.util.Date;
import java.util.concurrent.atomic.AtomicLong;

@Data
public class IotClientSessionForRedisContext extends IotClientSessionContext{
    private static final long serialVersionUID = 1L;

    private String channelId;

    private Date regTime;       //注册时间
    private Date expireTime;    //过期时间
    private Date lastCommunicateTime;    //最近一次通信时间
    private String tenantId;    //租户ID
    private String controlRealName;

    /**
     * 客户端IP
     */
    private String clientIp;

    /**
     * 端口
     */
    private int clientPort;

    /**
     * 协议
     */
    private String clientProtocol;

    /**
     * 代理ip
     */
    private String proxyIp;

    /**
     * 代理端口
     */
    private int proxyPort;

    /**
     * 代理协议
     */
    private String proxyProtocol;

    /**
     * 连接类型
     */
    private String connectType;

    /**
     * 解码失败数
     */
    private int decodeFailCount;

    /**
     * 用户ID
     */
    private String userId;

    /**
     * 用户token
     */
    private String token;


    /**
     * 统计开始时间
     */
    private Date gmtCreate;

    /**
     * 已接收字节数
     */
    private AtomicLong receivedBytes;

    /**
     * 已接收业务包
     */
    private AtomicLong receivedPackets;

    /**
     * 已接收TCP包
     */
    private AtomicLong receivedTcps;

    /**
     * 平均每个TCP包接收的字节数
     */
    private double bytesPerTcpReceive;

    /**
     * 平均每个TCP包接收的业务包
     */
    private double packetsPerTcpReceive;

    /**
     * 已处理的字节数
     */
    private AtomicLong handledBytes;

    /**
     * 已处理的业务包
     */
    private AtomicLong handledPackets;

    /**
     * 已发送的字节数
     */
    private AtomicLong sentBytes;

    /**
     * 已发送的业务包
     */
    private AtomicLong sentPackets;
}
