var ti_common;
(function (ti_common) {
    var CloudAgentAPI = (function () {
        function CloudAgentAPI($http) {
            this.$http = $http;
        }
        ;
        CloudAgentAPI.prototype.getLpListJson = function () {
            return this.$http.get('target_setup/data/lpList.json');
        };
        CloudAgentAPI.prototype.getConfigInfo = function (OS) {
            return this.$http.get('/ticloudagent/getConfigInfo?os=' + OS);
        };
        CloudAgentAPI.prototype.getConfigurables = function (OS, connectionID, deviceID) {
            return this.$http.get('/ticloudagent/getConfigurables/' + OS + '/' + connectionID + '/' + deviceID);
        };
        CloudAgentAPI.prototype.getSupportingFiles = function (ccxmlFileContents, OS, osBits) {
            var path = '/ticloudagent/getSupportingFiles?';
            path += 'os=' + OS;
            if (osBits) {
                path += '&bitSize=' + osBits;
            }
            return this.$http.post(path, ccxmlFileContents, {
                headers: {
                    'Content-Type': 'application/xml'
                }
            });
        };
        CloudAgentAPI.prototype.queryConfig = function (ccxmlFileContents, OS) {
            return this.$http.post('/ticloudagent/queryConfig?os=' + OS, ccxmlFileContents, {
                headers: {
                    'Content-Type': 'application/xml'
                }
            });
        };
        CloudAgentAPI.prototype.getConfig = function (OS, connectionID, deviceID, configurablesJson) {
            if (configurablesJson) {
                return this.$http.post('/ticloudagent/getConfigAdvanced?os=' + OS
                    + '&connectionID=' + connectionID
                    + '&deviceID=' + deviceID, configurablesJson, {
                    headers: {
                        'Content-Type': 'application/text'
                    }
                });
            }
            else {
                return this.$http.get('/ticloudagent/getConfig/' + OS + '/' + connectionID + '/' + deviceID);
            }
        };
        CloudAgentAPI.prototype.getFileContent = function (OS, path, contentType, version) {
            if (!contentType) {
                contentType = ti_common.file.ContentType.Text;
            }
            if (!version) {
                version = "LATEST";
            }
            return this.$http.get('/ticloudagent/getFile/' + OS + "/" + path + "/" + version, { responseType: ti_common.file.ResponseTypeConfigLookup[contentType] });
        };
        // stub implementation for cloud, as we don't have a need to shutdown dinfra at this time
        CloudAgentAPI.prototype.closeAgent = function () {
            return;
        };
        CloudAgentAPI.$inject = ['$http'];
        return CloudAgentAPI;
    }());
    ;
    angular.module('ti_common').service('ticAgentAPI', CloudAgentAPI);
})(ti_common || (ti_common = {}));
