'use strict';

/* Services */

var listAppServices = angular.module('listAppServices', ['ngResource']);
// var url = 'itested.europe.intranet:8888';
var url = 'localhost:5000';
//dev
//var url = 'build00001.nl.europe.intranet:8888';

listAppServices.factory('listApps', ['$resource',
        function($resource){
            return $resource('/list/apps', {}, {});
        }]);

listAppServices.factory('listVersions', ['$resource',
        function($resource){
            return $resource('/list/:app/versions', {
                app : '@app'
                }, {});
        }]);

listAppServices.factory('listEnvironments', ['$resource',
        function($resource){
            return $resource('/list/:app/:version/environments', {
                app : '@app',
                version : '@version'
                }, {});
        }]);

listAppServices.factory('listAppTestTypes', ['$resource', function($resource){
            return $resource('/list/:app/:version/:environment/testtypes', {
                app : '@app',
                version : '@version',
                environment : '@environment'
                }, {});
        }]);

listAppServices.factory('appDetails', ['$resource',
        function($resource){
            return $resource('/list/:app/:version/:environment/:testtype/details', {
                app : '@app',
                version : '@version',
                environment : '@environment',
                testtype : '@testtype'
                }, {query : { method: 'GET', isArray:false }});
        }]);

listAppServices.factory('getSummary', ['$resource',
        function($resource){
            return $resource('/get/summary/:app/:version/:environment/:testtype?format=json', {
                app : '@app',
                testtype : '@testtype',
                version : '@version',
                environment : '@environment'
                }, {query : { method: 'GET', isArray:false }});
        }]);

listAppServices.factory('getHistory', ['$resource',
        function($resource){
            return $resource('/get/history/:app/:environment/:testtype?format=json', {
                app : '@app',
                testtype : '@testtype',
                environment : '@environment'
                }, {query : { method: 'GET', isArray:false }});
        }]);
