11package org .launchcode .codingevents .models ;
22
3- import jakarta .validation .constraints .Email ;
4- import jakarta .validation .constraints .NotBlank ;
5- import jakarta .validation .constraints .Size ;
3+ import jakarta .validation .constraints .*;
64
75import java .util .Objects ;
86
@@ -24,14 +22,53 @@ public class Event {
2422 @ NotBlank (message = "Email is required" )
2523 @ Email (message = "Invalid email. Try again." )
2624 private String contactEmail ;
25+ @ NotBlank (message ="Location cannot be left blank." )
26+ private String location ;
27+ @ AssertTrue (message = "Registration must be required" )
28+ private boolean requiresRegistration ;
29+ @ Positive (message ="Number of attendees must be one or more." )
30+ private int numberOfAttendees ;
31+
32+ public String getLocation () {
33+ return location ;
34+ }
35+
36+ public void setLocation (String location ) {
37+ this .location = location ;
38+ }
39+
40+ public boolean isRequiresRegistration () {
41+ return requiresRegistration ;
42+ }
43+
44+ public void setRequiresRegistration (boolean requiresRegistration ) {
45+ this .requiresRegistration = requiresRegistration ;
46+ }
47+
48+ public int getNumberOfAttendees () {
49+ return numberOfAttendees ;
50+ }
2751
28- public Event (String name , String description , String contactEmail ) {
29- this ();
52+ public void setNumberOfAttendees (int numberOfAttendees ) {
53+ this .numberOfAttendees = numberOfAttendees ;
54+ }
55+
56+ public Event (String name , String description , String contactEmail , String location , boolean requiresRegistration , int numberOfAttendees ) {
3057 this .name = name ;
3158 this .description = description ;
3259 this .contactEmail = contactEmail ;
60+ this .location = location ;
61+ this .requiresRegistration = requiresRegistration ;
62+ this .numberOfAttendees = numberOfAttendees ;
3363 }
3464
65+ // public Event(String name, String description, String contactEmail) {
66+ // this();
67+ // this.name = name;
68+ // this.description = description;
69+ // this.contactEmail = contactEmail;
70+ // }
71+
3572 public Event () {
3673 this .id = nextId ;
3774 nextId ++;
0 commit comments