package com.hubspot.baragon.models;

import java.util.Objects;

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

public class TrafficSource {
  private final String name;
  private final TrafficSourceType type;

  @JsonCreator
  public static TrafficSource fromString(String input) {
    return new TrafficSource(input, TrafficSourceType.CLASSIC);
  }

  @JsonCreator
  public TrafficSource(@JsonProperty("name") String name, @JsonProperty("type") TrafficSourceType type) {
    this.name = name;
    this.type = type;
  }

  public String getName() {
    return name;
  }

  public TrafficSourceType getType() {
    return type;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj instanceof TrafficSource) {
      final TrafficSource that = (TrafficSource) obj;
      return Objects.equals(this.name, that.name) &&
          Objects.equals(this.type, that.type);
    }
    return false;
  }

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

  @Override
  public String toString() {
    return "TrafficSource{" +
        "name='" + name + '\'' +
        ", type=" + type +
        '}';
  }
}

@@ -53,24 +53,112 @@
 l.Objects;%0A%0A
+import javax.validation.constraints.NotNull;%0Aimport javax.validation.constraints.Size;%0A%0A
 import com.f
@@ -198,16 +198,16 @@
 reator;%0A
-
 import c
@@ -282,16 +282,33 @@
 ource %7B%0A
+  @Size(min = 1)%0A
   privat
@@ -327,16 +327,28 @@
 ng name;
+%0A%0A  @NotNull
 %0A  priva

Add server-side validation to TrafficSource