package com.namelessmc.java_api;

import org.jetbrains.annotations.NotNull;

import com.google.gson.JsonObject;

public class Group implements Comparable<Group> {

	private final int id;
	@NotNull
	private final String name;
	private final int order;
	private final boolean staff;

	Group(@NotNull final JsonObject group) {
		this.id = group.get("id").getAsInt();
		this.name = group.get("name").getAsString();
		this.order = group.get("order").getAsInt();
		this.staff = group.has("staff") && group.get("staff").getAsBoolean();
	}

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

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

	public int getOrder() {
		return this.order;
	}

	public boolean isStaff() {
		return this.staff;
	}

	@Override
	public int compareTo(final Group other) {
		return this.order - other.order;
	}

	@Override
	public boolean equals(Object other) {
		return other instanceof Group &&
				((Group) other).id == this.id;
	}

	@Override
	public String toString() {
		return "Group[id=" + id + ",name=" + name + "]";
	}

}

@@ -106,16 +106,43 @@
 bject;%0A%0A
+import java.util.Objects;%0A%0A
 public c
@@ -974,24 +974,99 @@
 his.id;%0A%09%7D%0A%0A
+%09@Override%0A%09public int hashCode() %7B%0A%09%09return Objects.hash(839891, id);%0A%09%7D%0A%0A
 %09@Override%0A%09

implement hashcode