angular.module("mediaModal")
    .config([
        '$httpProvider', 'fileUploadProvider', '$sceDelegateProvider',
        function ($httpProvider, fileUploadProvider, $sceDelegateProvider) {

            $sceDelegateProvider.resourceUrlWhitelist([
                'self',
                'http://business.otonomic.com/**'
            ]);

            delete $httpProvider.defaults.headers.common['X-Requested-With'];
            fileUploadProvider.defaults.redirect = window.location.href.replace(
                /\/[^\/]*$/,
                '/cors/result.html?%s'
            );
            // Uploader settings:
            angular.extend(fileUploadProvider.defaults, {
                autoUpload: true,
                forceIframeTransport: true,
                // Enable image resizing, egrunt devxcept for Android and Opera,
                // which actually support image resizing, but fail to
                // send Blob objects via XHR requests:
                disableImageResize: /Android(?!.*Chrome)|Opera/
                    .test(window.navigator.userAgent),
                /*maxFileSize: 9990000,*/
                acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
            });
        }
    ])
    .constant("flickrApiKey", "b5245e9b9cbaeecee26ea278bfa20253")
    .constant("upload_url", "http://business.otonomic.com/api/v1/?cmd=upload")
    .constant("instagramApiKey", "44171713.10d405b.25e232f920f94ac9907d8c0ea34ce1de")
    //.constant("facebookApiKey", "CAACEdEose0cBAJuIrBZCXQZBpMRGixqcQun3gJAwUL2cfGZB0iuvLu5lpDJy3txqnhAbdbFneQHpZACHiWQsymYxZCtFbH3GuB87NpQdZB8DvtUGIpmZCF3yip71ZBqqajhgw8uPcuaerccTBYZC1gXtGZAV11gvcrYOodJNnT87aJQ1ZBR9T4AX7NHJZCQfmJIIOd6k6oR55ubMZBy7R6ZBAYylzC")
    .constant("facebookApiKey", "CAANkofzWtSoBAG0FcIPXZAFFUJjZBdZAiejDxnPXXapvIP1UZA9ZBKiryHlB3GZCjrY1P3rgnKO70AWYQ1bLFp03MxZAuYTaimqsETawQxE9PRhCuLKHZCxDd9wrzJQrqXMsscI80UzPapvPoQKa9WeE7NHIN8H30lb48AhXqZAbVbX7w33nuEhI8ZCPc56VnTS2IZD")
    .constant("pexelsApiKey", "563492ad6f9170000100000183fb18af4b5f4b5c6a67f7e6433578ba")

    .factory("availableResources", function(enums){
        return [{
            title: "Camera",
            icon: "fa fa-camera",
            viewPath: "camera.html"
        },{
            title: "Upload",
            icon: "fa fa-cloud-upload",
            viewPath: "upload.html"
        },{
            title: "Flickr",
            icon: "fa fa-flickr",
            viewPath: "webService.html",
            webServiceType: enums.webServiceTypes.flickr
        },{
            title: "Instagram",
            icon: "fa fa-instagram",
            viewPath: "webService.html",
            webServiceType: enums.webServiceTypes.instagram
        },{
            title: "Background Patterns",
            icon: "fa fa-star",
            viewPath: "webService.html",
            webServiceType: enums.webServiceTypes.backgroundPatterns
        },{
            title: "Facebook Photos",
            icon: "fa fa-facebook",
            viewPath: "webService.html",
            webServiceType: enums.webServiceTypes.facebookPhotos
        },{
            title: "Facebook Users",
            icon: "fa fa-facebook-official",
            viewPath: "webService.html",
            webServiceType: enums.webServiceTypes.facebookUsers
        },{
            title: "Pexels",
            icon: "fa fa-picture-o",
            viewPath: "webService.html",
            webServiceType: enums.webServiceTypes.pexels
        }];
    });