package edu.deanza.calendar.models;

import org.joda.time.LocalTime;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Sara on 5/28/2016.
 */
public class Event {

    protected String name, description, location;
    protected LocalTime startTime, endTime;

    // TODO: implement `categories` field

    public Event() {}

    public Event(String name, String description, String location, String startTime,
                 String endTime) {
        this.name = name;
        this.description = description;
        this.location = location;
        this.startTime = LocalTime.parse(startTime);
        this.endTime = LocalTime.parse(endTime);

    }

    public static Event fromJson(JSONObject eventJson) {
        Event e = new Event();
        try {
            e.name = eventJson.getString("name");
            e.description = eventJson.getString("description");
            e.location = eventJson.getString("location");
            e.startTime = LocalTime.parse(eventJson.getString("start_time"));
            e.endTime = LocalTime.parse(eventJson.getString("end_time"));
        }
        catch (JSONException ex) {
            ex.printStackTrace();
            return null;
        }
        return e;
    }

}
@@ -1241,9 +1241,343 @@
 %0A    %7D%0A%0A
+    public String getName() %7B%0A        return name;%0A    %7D%0A%0A    public String getDescription() %7B%0A        return description;%0A    %7D%0A%0A    public String getLocation() %7B%0A        return location;%0A    %7D%0A%0A    public LocalTime getStartTime() %7B%0A        return startTime;%0A    %7D%0A%0A    public LocalTime getEndTime() %7B%0A        return endTime;%0A    %7D%0A%0A
 %7D

Add public accessors