package com.yonge.cooleshow.common.entity;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

public class ImGroupModel{
    //群组编号
    private String id;
    //用户列表
    private ImGroupMember[] members;
    //用户列表
    private List<ImGroupMember> memberList;
    //群名称
    private String name;
    private String teacherIds;
    private String img;
    private String groupName;
    private Integer minute;
    private Integer count;
    private Integer status;
    private String userRole;

    public ImGroupModel() {
    }

    public ImGroupModel(String id) {
        this.id = id;
    }

    public ImGroupModel(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public ImGroupModel(String id, ImGroupMember[] members, String name) {
        this.id = id;
        this.members = members;
        this.name = name;
    }

    public String getUserRole() {
        return userRole;
    }

    public void setUserRole(String userRole) {
        this.userRole = userRole;
    }

    public List<ImGroupMember> getMemberList() {
        return memberList;
    }

    public void setMemberList(List<ImGroupMember> memberList) {
        this.memberList = memberList;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getTeacherIds() {
        return teacherIds;
    }

    public void setTeacherIds(String teacherIds) {
        this.teacherIds = teacherIds;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public ImGroupModel(String id, ImGroupMember[] members, String name, Integer minute) {
        this.id = id;
        this.members = members;
        this.name = name;
        this.minute = minute;
    }

    public ImGroupModel(String id, Integer status) {
        this.id = id;
        this.status = status;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getId() {
        return this.id;
    }

    public ImGroupModel setId(String id) {
        this.id = id;
        return this;
    }

    public ImGroupMember[] getMembers() {
        return this.members;
    }

    public ImGroupModel setMembers(ImGroupMember[] members) {
        if(members != null && members.length > 0){
            this.members = members;
        }
        return this;
    }

    public String getName() {
        return this.name;
    }

    public ImGroupModel setName(String name) {
        this.name = name;
        return this;
    }

    public Integer getMinute() {
        return this.minute;
    }

    public ImGroupModel setMinute(Integer minute) {
        this.minute = minute;
        return this;
    }

    public Integer getStatus() {
        return this.status;
    }

    public ImGroupModel setStatus(Integer status) {
        this.status = status;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ImGroupModel that = (ImGroupModel) o;
        return id.equals(that.id) && Arrays.equals(members, that.members) && memberList.equals(that.memberList);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(id, memberList);
        result = 31 * result + Arrays.hashCode(members);
        return result;
    }
}
