package com.mb3364.twitch.api.models;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Date;

@JsonIgnoreProperties(ignoreUnknown = true)
public class User {

    private String name;
    @JsonProperty("_id")
    private long id;
    private String displayName;
    private String logo;
    private String type;
    private String bio;
    private Date updatedAt;
    private Date createdAt;

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", id=" + id +
                ", displayName='" + displayName + '\'' +
                ", logo='" + logo + '\'' +
                ", type='" + type + '\'' +
                ", bio='" + bio + '\'' +
                ", updatedAt=" + updatedAt +
                ", createdAt=" + createdAt +
                '}';
    }

    @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 == user.id;

    }

    @Override
    public int hashCode() {
        return (int) (id ^ (id >>> 32));
    }

    /**
     * This will handle a caching bug when a v2 user is returned
     * from the API rather than the expected v3 user.
     */
    public void setStaff(boolean staff) {
        if (staff) {
            this.type = "staff";
        } else {
            this.type = "user";
        }
    }

    public String getName() {

        return name;
    }

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

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getDisplayName() {
        return displayName;
    }

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

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getBio() {
        return bio;
    }

    public void setBio(String bio) {
        this.bio = bio;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }
}

@@ -1227,24 +1227,70 @@
 2));%0A    %7D%0A%0A
+    public void setStaff(boolean staff) %7B%0A    
     /**%0A    
@@ -1290,16 +1290,20 @@
 **%0A     
+  
+  
 * This w
@@ -1359,16 +1359,20 @@
 ed%0A     
+    
 * from t
@@ -1421,52 +1421,14 @@
     
-*/%0A
     
-public void setStaff(boolean staff) %7B
+*/
 %0A   

Move a comment to its correct place