package cn.com.ty.lift.ud.chat.controller.model;


import java.util.Objects;

import cn.com.ty.lift.ud.chat.controller.MyWebSocket;
import cn.com.ty.lift.ud.chat.mapper.entity.ChatSessionEntity;
import lombok.Data;

@Data
public class User {

    private String id;
    private String room;
    private String nickname;
    private MyWebSocket webSocket;
    
    private ChatSessionEntity sessionEntity;

    public User() {
    }


    public User(ChatSessionEntity sessionEntity,String id, String room ,String nickname, MyWebSocket webSocket) {
        this.id = id;
        this.room = room;
        this.nickname = nickname;
        this.webSocket = webSocket;
        this.sessionEntity = sessionEntity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return id.equals(user.getId());
    }

    @Override
    public int hashCode() {

        return Objects.hash(id);
    }
}
