package com.hubspot.singularity;

import static com.google.common.collect.ImmutableSet.copyOf;

import java.util.Objects;
import java.util.Set;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Optional;

public class SingularityUser {
  private final String id;
  private final Optional<String> name;
  private final Optional<String> email;
  private final Set<String> groups;
  private final Optional<SingularityUserSettings> settings;

  @JsonCreator
  public SingularityUser(@JsonProperty("id") String id, @JsonProperty("name") Optional<String> name,
                         @JsonProperty("email") Optional<String> email, @JsonProperty("groups") Set<String> groups,
                         @JsonProperty("settings") Optional<SingularityUserSettings> settings) {
    this.id = id;
    this.name = name;
    this.email = email;
    this.groups = copyOf(groups);
    this.settings = settings;
  }

  public String getId() {
    return id;
  }

  public Optional<String> getName() {
    return name;
  }

  public Optional<String> getEmail() {
    return email;
  }

  public Set<String> getGroups() {
    return groups;
  }

  @Override
  public String toString() {
    return "SingularityUser[" +
            "id='" + id + '\'' +
            ", name=" + name +
            ", email=" + email +
            ", groups=" + groups +
            ']';
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    SingularityUser that = (SingularityUser) o;
    return Objects.equals(id, that.id) &&
            Objects.equals(name, that.name) &&
            Objects.equals(email, that.email) &&
            Objects.equals(groups, that.groups);
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, name, email, groups);
  }
}

@@ -462,68 +462,8 @@
 ups;
-%0A  private final Optional%3CSingularityUserSettings%3E settings;
 %0A%0A  
@@ -694,103 +694,8 @@
 oups
-,%0A                         @JsonProperty(%22settings%22) Optional%3CSingularityUserSettings%3E settings
 ) %7B%0A
@@ -758,16 +758,16 @@
  email;%0A
+
     this
@@ -796,38 +796,8 @@
 s);%0A
-    this.settings = settings;%0A
   %7D%0A

Remove UserSettings from User class