package com.robocubs4205.cubscout.model;

import org.springframework.hateoas.Identifiable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by trevor on 2/14/17.
 */
@Entity
public class District implements Identifiable<String> {
    @Id
    private String code;

    private String name;

    @OneToMany(mappedBy = "district")
    private Set<Event> events = new HashSet<>();

    @OneToMany(mappedBy = "district")
    private Set<Team> teams = new HashSet<>();

    public District(){}

    public District(String code){
        setCode(code);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

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

    @Override
    public String getId() {
        return getCode();
    }

    public Set<Event> getEvents() {
        return events;
    }

    public Set<Team> getTeams() {
        return teams;
    }
}

@@ -183,16 +183,61 @@
 ToMany;%0A
+import javax.validation.constraints.NotNull;%0A
 import j
@@ -382,16 +382,29 @@
 ring%3E %7B%0A
+    @NotNull%0A
     @Id%0A
@@ -425,24 +425,37 @@
 ring code;%0A%0A
+    @NotNull%0A
     private 

add @NotNull annotations to code and name properties of district class