// configuration web service proxy
webservices.factory('dashboardService', ['$http', 'apiConfig', function ($http, apiConfig) {
    'use strict';
    return {
        
        getChartSetting: function (chartId)
        {
            return $http.get('/Dashboard/ChartSetting/' + chartId, apiConfig.create());
        },

        removeChartSetting: function (chartId)
        {
            return $http.delete('/Dashboard/ChartSetting/' + chartId, apiConfig.create());
        },

        updateChartSortId: function(onechartId,anotherChartId){
            return $http.put('/Dashboard/ChartSort/' + onechartId + '/' + anotherChartId, {_:2}, apiConfig.create());
        },

        getChartData: function (chartType,projectList,yearList,monthList)
        {
            return $http.post('/Dashboard/ChartData/' + chartType, { PorjectIdList: projectList, ProjectYearList: yearList, MonthList: monthList }, apiConfig.create());
        },

        getRangeChartData: function (chartType, projectList, endDate, isMonth)
        {
            return $http.post('/Dashboard/RangeChartData/' + chartType, { PorjectIdList: projectList, EndDate: endDate, IsMonth: isMonth }, apiConfig.create());
        },

        saveSetting: function (chartId,chartName, chartType ,argumentField, valueField, showValue)
        {
            return $http.put('/Dashboard/ChartSetting/' + chartId, {Name: chartName, ChartTypeValue: chartType, ArgumentField: argumentField, valueField: valueField, ShowValue: showValue}, apiConfig.create())
        },

        getChartList: function ()
        {
            return $http.get('/Dashboard/ChartList', apiConfig.create());
        },

        getSystemChartList: function () {
            return $http.get('/Dashboard/systemcharts', apiConfig.create());
        },

        addUserChart: function (systemchartId) {
            return $http.get('/Dashboard/addUserChart/' + systemchartId, apiConfig.create());
        }
    };
}]);