// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.sps.data;

import java.util.ArrayList;

public final class SampleData {
    private static final int TIME_0800AM = TimeRange.getTimeInMinutes(8, 00);
    private static final int TIME_0900AM = TimeRange.getTimeInMinutes(9, 00);
    private static final int TIME_1000AM = TimeRange.getTimeInMinutes(10, 00);
    private static final int TIME_1100AM = TimeRange.getTimeInMinutes(11, 00);
    private static final int TIME_1200AM = TimeRange.getTimeInMinutes(12, 00);
    private static final int TIME_0100PM = TimeRange.getTimeInMinutes(13, 00);
    private static final int TIME_0200PM = TimeRange.getTimeInMinutes(14, 00);
    private static final int TIME_0300PM = TimeRange.getTimeInMinutes(15, 00);
    private static final int TIME_0500PM = TimeRange.getTimeInMinutes(17, 00);
    
    private ArrayList<Tutor> tutors;

    public SampleData() {
        tutors = new ArrayList<Tutor>();
        tutors.add(new Tutor("Kashish Arora", "kashisharora@google.com", new String[]{"Math", "History"}, new TimeRange[]{TimeRange.fromStartToEnd(TIME_1200AM, TIME_0100PM), TimeRange.fromStartToEnd(TIME_0300PM,TIME_0500PM)}));
        tutors.add(new Tutor("Bernardo Eilert Trevisan", "btrevisan@google.com", new String[]{"English", "Physics"}, new TimeRange[]{TimeRange.fromStartToEnd(TIME_0800AM, TIME_1000AM), TimeRange.fromStartToEnd(TIME_1100AM,TIME_0100PM)}));
        tutors.add(new Tutor("Sam Falberg", "sfalberg@google.com", new String[]{"Geology", "English"}, new TimeRange[]{TimeRange.fromStartToEnd(TIME_1000AM, TIME_1200AM), TimeRange.fromStartToEnd(TIME_0100PM,TIME_0200PM)}));
        tutors.add(new Tutor("Anand Desai", "thegoogler@google.com", new String[]{"Finance", "Chemistry"}, new TimeRange[]{TimeRange.fromStartToEnd(TIME_1000AM, TIME_1200AM), TimeRange.fromStartToEnd(TIME_0100PM,TIME_0200PM)}));
        tutors.add(new Tutor("Elian Dumitru", "elian@google.com", new String[]{"Geology", "Math"}, new TimeRange[]{TimeRange.fromStartToEnd(TIME_1000AM, TIME_1200AM), TimeRange.fromStartToEnd(TIME_0100PM,TIME_0200PM)}));
    }

    public ArrayList<Tutor> getSampleTutors() {
        return this.tutors;
    }

}

@@ -640,16 +640,100 @@
 ayList;%0A
+import java.util.Arrays;%0A%0A/** Class that stores sample Tutor objects for testing. */
 %0Apublic 
@@ -1483,16 +1483,23 @@
 private 
+static 
 ArrayLis
@@ -1517,97 +1517,56 @@
 tors
-;%0A%0A    public SampleData() %7B%0A        tutors = new ArrayList%3CTutor%3E();%0A        tutors.add(
+ = new ArrayList%3CTutor%3E (Arrays.asList(%0A        
 new 
@@ -1763,26 +1763,25 @@
 ME_0500PM)%7D)
-);
+,
 %0A        tut
@@ -1773,35 +1773,24 @@
 %7D),%0A        
-tutors.add(
 new Tutor(%22B
@@ -1990,26 +1990,25 @@
 ME_0100PM)%7D)
-);
+,
 %0A        tut
@@ -2000,35 +2000,24 @@
 %7D),%0A        
-tutors.add(
 new Tutor(%22S
@@ -2199,34 +2199,33 @@
 M,TIME_0200PM)%7D)
-);
+,
 %0A        tutors.
@@ -2213,35 +2213,24 @@
 %7D),%0A        
-tutors.add(
 new Tutor(%22A
@@ -2420,26 +2420,25 @@
 ME_0200PM)%7D)
-);
+,
 %0A        tut
@@ -2438,19 +2438,8 @@
     
-tutors.add(
 new 
@@ -2637,16 +2637,16 @@
 M)%7D)
-);
 %0A    
-%7D
+));
 %0A%0A  
@@ -2654,16 +2654,23 @@
  public 
+static 
 ArrayLis
@@ -2718,18 +2718,792 @@
 rn t
-his.t
 utors
+;%0A    %7D%0A%0A    public static void addTutor(Tutor tutor) %7B%0A        tutors.add(tutor);%0A    %7D%0A%0A    /** Finds and deletes a tutor with given email. */%0A    public static void deleteTutorByEmail(String email) %7B%0A        for(Tutor tutor : tutors) %7B%0A            if(tutor.getEmail().toLowerCase().equals(email.toLowerCase())) %7B%0A                tutors.remove(tutor);%0A                break;%0A            %7D%0A        %7D%0A    %7D%0A%0A    /** Finds and returns a tutor that has the given email. If no such tutor is found, returns null.%0A    * @return Tutor%0A    */%0A    public static Tutor getTutorByEmail(String email) %7B%0A        for(Tutor tutor : tutors) %7B%0A            if(tutor.getEmail().toLowerCase().equals(email.toLowerCase())) %7B%0A                return tutor;%0A            %7D%0A        %7D%0A%0A        return null
 ;%0A  

Make sample data static (#25)