angular.module("mediaModal")
.factory("webStorage", function(enums, flickr, instagram, backgroundPatterns, facebookUsers, pexels, facebookPhotos){
        function getService(serviceType){
            switch (serviceType){
                case enums.webServiceTypes.flickr:
                    return flickr;
                case enums.webServiceTypes.instagram:
                    return instagram;
                case enums.webServiceTypes.backgroundPatterns:
                    return backgroundPatterns;
                case enums.webServiceTypes.facebookUsers:
                    return facebookUsers;
                case enums.webServiceTypes.pexels:
                    return pexels;
                case enums.webServiceTypes.facebookPhotos:
                    return facebookPhotos;
            }
        }
        function search(storageType, searchString, page, count){
            return getService(storageType).search(searchString, page, count);
        }

        function loadMore(storageType){
            return getService(storageType).loadMore();
        }

        return{
            search: search,
            loadMore: loadMore
        }
    }
);