package com.tencent.trtc.videocall;

import androidx.annotation.Nullable;

public class UserInfo {
    String personid;
    String displayName;
    boolean isLocal;

    boolean frontCamera = true;

    public String getPersonid() {
        return personid;
    }

    public UserInfo setPersonid(String personid) {
        this.personid = personid;
        return this;
    }

    public String getDisplayName() {
        return displayName;
    }

    public UserInfo setDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    public boolean isLocal() {
        return isLocal;
    }

    public UserInfo setLocal(boolean local) {
        isLocal = local;
        return this;
    }

    public boolean isFrontCamera() {
        return frontCamera;
    }

    public UserInfo setFrontCamera(boolean frontCamera) {
        this.frontCamera = frontCamera;
        return this;
    }


    @Override
    public int hashCode() {
        return getPersonid().hashCode();
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if(obj == null){
            return false;
        }
        if(obj instanceof UserInfo){
            return getPersonid()  == null ? ((UserInfo) obj).getPersonid() == null
                    : getPersonid().equals(((UserInfo) obj).getPersonid());
        }else if(obj instanceof String){
            return getPersonid()  == null ? obj == null : getPersonid().equals(obj);
        }
        return false;
    }
}
