package edu.rpi.cs.yacs.retrofit;

import edu.rpi.cs.yacs.models.Course;
import edu.rpi.cs.yacs.models.School;
import edu.rpi.cs.yacs.models.Section;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;

/**
 * Created by Mark Robinson on 9/24/16.
 */

interface YACSService {
    /**
     * This method fetches all courses given a query to search.
     * @param query string to search
     * @return Relevant Course objects of query
     */
    @GET("courses.json?search={query}")
    Call<Course> courseSearch(@Path("query") String query);

    /**
     * This method fetches all schools and departments of the college.
     * @return Relevant School objects
     */
    @GET("/schools.json?show_departments=true")
    Call<School> loadDepartments();

    /**
     * This method fetches all courses of a given department.
     * @param department_code department code to fetch courses
     * @return Relevant Course objects of department_code
     */
    @GET("/courses.json?department_code={department_code}")
    Call<Course> loadCoursesByDepartment(@Path("department_code") String department_code);

    /**
     * This method fetches all sections and periods of a given course.
     * @param course_id course id to fetch sections and periods
     * @return Relevant Section objects of course_id
     */
    @GET("/sections.json?course_id={course_id}&show_periods=true")
    Call<Section> loadCourseSections(@Path("course_id") int course_id);
}
@@ -215,20 +215,21 @@
 t2.http.
-Path
+Query
 ;%0A%0A/**%0A 
@@ -339,77 +339,47 @@
 all 
-courses given a query to search.%0A     * @param query string to search
+schools and departments of the college.
 %0A   
@@ -395,38 +395,38 @@
 rn Relevant 
-Course
+School
  objects
  of query%0A  
@@ -417,17 +417,8 @@
 ects
- of query
 %0A   
@@ -436,22 +436,23 @@
 ET(%22
-course
+/school
 s.json?s
 earc
@@ -451,163 +451,183 @@
 on?s
-earch=%7Bquery%7D%22)%0A    Call%3CCourse%3E courseSearch(@Path(%22query%22) String query);%0A%0A    /**%0A     * This method fetches all schools and departments of the college.
+how_departments=true%22)%0A    Call%3CSchool%3E loadDepartments();%0A%0A    /**%0A     * This method fetches all courses given a query to search.%0A     * @param search query string to search
 %0A   
@@ -643,38 +643,38 @@
 rn Relevant 
-School
+Course
  objects
 %0A     */%0A   
@@ -653,32 +653,41 @@
 t Course objects
+ of query
 %0A     */%0A    @GE
@@ -694,78 +694,90 @@
 T(%22/
-schools.json?show_departments=true%22)%0A    Call%3CSchool%3E loadDepartments(
+courses.json%22)%0A    Call%3CCourse%3E loadCoursesBySearch(@Query(%22search%22) String search
 );%0A%0A
@@ -1002,42 +1002,8 @@
 json
-?department_code=%7Bdepartment_code%7D
 %22)%0A 
@@ -1043,20 +1043,21 @@
 rtment(@
-Path
+Query
 (%22depart
@@ -1327,30 +1327,8 @@
 son?
-course_id=%7Bcourse_id%7D&
 show
@@ -1385,12 +1385,13 @@
 ns(@
-Path
+Query
 (%22co

Modify YACSService