package edu.deanza.calendar.models;

//constructor for localDateTime: LocalDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour)

import org.joda.time.LocalDateTime;
import java.util.ArrayList;

/**
 * Created by Sara on 5/28/2016.
 */
public class Event {
    protected String name, description, place;
    protected LocalDateTime start, finish;
    protected enum source {
        Facebook, ClubMeeting, TransferAppointment, Website
    }
    protected ArrayList<String> tags;

    Event()
    {

    }

    Event(String eventName, String details, String location, LocalDateTime startTime,
          LocalDateTime finishTime)
    {
        name = eventName;
        description = details;
        place = location;
        start = startTime;
        finish = finishTime;

        tags = new ArrayList<String>();
        //generate_tags();
    }

    //NEED TO ALPHABETIZE ALL TAGS
    protected void generate_tags()
    {
        int tempDay = start.getDayOfWeek();
        switch (tempDay)
        {
            case 1: tags.add("Mo");
                break;
            case 2: tags.add("Tu");
                break;
            case 3: tags.add("We");
                break;
            case 4: tags.add("Th");
                break;
            case 5: tags.add("Fr");
                break;
            case 6: tags.add("Sa");
                break;
            case 7: tags.add("Su");
                break;
            //no default case
        }
        //does this make sense to continue with month and month/day?
        //cases from LocalDateTime API http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTimeConstants.html

        //This will split the string around the spaces and stores them into the given string array
        String tempNameArr[] = name.split(" ");
        for (String tempName : tempNameArr)
        {
            tags.add(tempName);
        }

        //excessive?
        String tempDescriptionArr[] = description.split(" ");
        for (String tempDescription : tempDescriptionArr)
        {
            tags.add(tempDescription);
        }
    }

    //allows us to add any tag to list
    public void tag(String t)
    {
        tags.add(t);
        //sort/alphabetize new tag
    }

    /*public boolean search_tags(String input)
    {
        //return ArrayList<String> instead?
        String keys[] = input.split(" ");
        for (String key: keys)
            if (tags.contains(key)) //or do another for loop, check beginning of input to match tags
                return true;
        //display in ListView
    }*/
}

@@ -176,28 +176,24 @@
 a.time.Local
-Date
 Time;%0Aimport
@@ -317,21 +317,24 @@
 iption, 
-place
+location
 ;%0A    pr
@@ -342,28 +342,24 @@
 tected Local
-Date
 Time start, 
@@ -360,16 +360,21 @@
 tart
-, finish
+Time, endTime
 ;%0A  
@@ -547,22 +547,17 @@
 (String 
-eventN
+n
 ame, Str
@@ -562,21 +562,25 @@
 tring de
-tails
+scription
 , String
@@ -590,29 +590,22 @@
 cation, 
-LocalDateTime
+String
  startTi
@@ -622,28 +622,18 @@
     
-LocalDateTime finish
+String end
 Time
@@ -652,21 +652,21 @@
     
+this.
 name = 
-eventN
+n
 ame;
@@ -674,16 +674,21 @@
         
+this.
 descript
@@ -699,13 +699,17 @@
 = de
-tails
+scription
 ;%0A  
@@ -718,13 +718,21 @@
     
-place
+this.location
  = l
@@ -752,16 +752,41 @@
     
-start = 
+this.startTime = LocalTime.parse(
 star
@@ -786,24 +786,25 @@
 se(startTime
+)
 ;%0A        fi
@@ -805,27 +805,47 @@
     
-finish = finish
+this.endTime = LocalTime.parse(end
 Time
+)
 ;%0A%0A 

Refactor names and types to match those of DTO