'use strict';


var NavigationService = angular.module('navigation.services', [
])
    .service('NavigationService', [
        '$http',
        '$q',
        function ($http, $q) {
            var main = function (key) {
                var deferred = $q.defer();
                if (!key) key = 'main';

                deferred.resolve(data[key]);
                return deferred.promise;
            };

            var find = function(items, name) {
                for (var i = 0; i < items.length; i++) {
                    if (items[i].name == name)
                        return items[i];
                }
                return null;
            };

            var language = function (key) {
                var deferred = $q.defer();
                if (!key) key = 'main';

                deferred.resolve(jezici[key]);
                return deferred.promise;
            };

       
            var jezici = {
                main: [
                    { name: 'sr', title: 'lat', cssClass: 'latinica' },
                    { name: 'en', title: 'en', cssClass: 'engleski' }   
                ]
            };


            return {
                main: main,
                find: find,
                language: language
            };
        }
    ]);