angular.module('CourseMaterialApp')
    .factory('subsidizedStudentFactory', ['$http', function ($http) {
        var urlBase = appUrl+'api/student';
        var studentFactory = {};

        studentFactory.getStudents = function () {
            return $http.get(urlBase);
        };

        studentFactory.getStudent = function (id, term) {
            return $http.get(urlBase + '/' + id+'/' + term);
        };

        studentFactory.getOrders = function (id) {
            return $http.get(urlBase + '/' + id + '/orders');
        };

        return studentFactory;
    }])
    .factory('courseFactory', ['$http', function ($http) {
        var urlBase = appUrl + 'api/home';
        var courseFactory = {};

        courseFactory.getViewmodel = function (term) {
            return $http.get(urlBase+'/viewmodel/'+term);
        };

        courseFactory.getStudent = function (term) {
            return $http.get(urlBase + '/' + term);
        };
        // api/international/deadlines/all
        courseFactory.getTerms = function() {
            return $http.get(appUrl + 'api/international/deadlines/all');
        };

        courseFactory.getStudentTerms = function() {
            return $http.get(appUrl + 'api/home/student/terms');
        };

        return courseFactory;
    }]);