// web service proxy for customer
webservices.factory('workflowService', ['$http', 'apiConfig', 'httpCacheService',
function ($http, apiConfig, httpCacheService) {
    'use strict';
     
    return {
        getWorkflowCategoryList: function () {
            return $http.get('/workflow/getWorkflowCategoryList', apiConfig.create());
        },
        getWorkflowCategorymenuList: function () {
            return $http.get('/workflow/getWorkflowCategorymenuList', apiConfig.create());
        },
        getOrgMenuList: function () {
            return $http.get('/workflow/getOrgMenuList', apiConfig.create());
        },
        getWorkflowBasicInfo: function (id) {
            return $http.get('/workflow/getWorkflowBasicInfo?id=' + id, apiConfig.create());
        },
        getWorkFlowDisplayInfo: function (id) {
            return $http.get('/workflow/getWorkFlowDisplayInfo?id=' + id, apiConfig.create());
        },
        getTaskListByNodeID: function (id) {
            return $http.get('/workflow/getTaskListByNodeID?id=' + id, apiConfig.create());
        },
        getExistWorkflowOrgList: function (orgList) {
            return $http.post('/workflow/getExistWorkflowOrgList', orgList, apiConfig.create());
        },
        getWorkflowNodeByOrgList: function (orgIDList) {
            return $http.post('/workflow/getWorkflowNodeByOrgList', orgIDList, apiConfig.create());
        },
        getWorkflowNodeByYearMonth: function (year, month, serviceId) {
            return $http.get('/workflow/getWorkflowNodeByYearMonth?year=' + year + '&month=' + month + '&serviceType=' + serviceId, apiConfig.create());
        },
        getPushNotifications: function (criteria) {

            return $http.post('/workflow/getPushNotifications', {

                IsFirstTimeLoading: criteria.isFirstTimeLoading,
                FilterType: criteria.filterType,
                ServiceType: criteria.serviceType,
                MainFilter: criteria.mainFilter,
                SingleNode: criteria.singleNode,
                SingleTask: criteria.singleTask,
                MultipleNode: criteria.multipleNode,
                MultipleTask: criteria.multipleTask,
                MultipleStatus: criteria.multipleStatus,
                MultipleDueDate: criteria.multipleDueDate,
                MultiplePriority: criteria.multiplePriority,
                MultipleType: criteria.multipleType,
                SearchKeyword: criteria.searchKeyword
            }, apiConfig.create());
          
        },

        setMessageRead: function (id) {
            return $http.get('/workflow/setMessageRead?id=' + id, apiConfig.create());
        },
        getApprovalLogInfo: function (workflowNodeId, dbName, periodId, serviceTypeId) {
            return $http.get('/workflow/getApprovalLogInfo?workflowNodeId=' + workflowNodeId + '&dbName=' + dbName + '&periodId=' + periodId + '&serviceTypeId=' + serviceTypeId, apiConfig.create());
        },

        getErpValidationInfo: function ( dbName, periodId, serviceTypeId) {
            return $http.get('/workflowMessageJob/getErpValidationInfo?dbName=' + dbName + '&periodId=' + periodId + '&serviceTypeId=' + serviceTypeId, apiConfig.create());
        },
        
       
        updateTaskMessage: function (workflowMessageList) {
            return $http.post('/workflow/updateTaskMessage', workflowMessageList, apiConfig.create());
        },
        addWorkFlow: function (workflow) {
            return $http.post('/workflow/addWorkFlow', workflow, apiConfig.create());
        },
        updateWorkFlow: function (workflow) {
            return $http.post('/workflow/updateWorkFlow', workflow, apiConfig.create());
        },
        copyWorkFlow: function (workflow) {
            return $http.post('/workflow/copyWorkFlow', workflow, apiConfig.create());
        },
        getWorkflowNodeAndTask: function () {
            return $http.get('/workflow/getWorkflowNodeAndTask', apiConfig.create());
        },
        getDicTaskListByNodeID: function (nodeID) {
            return $http.get('/workflow/getDicTaskListByNodeID?nodeID=' + nodeID, apiConfig.create());
        },
        getTaskMessageUserRole: function (taskID) {
            return $http.get('/workflow/getTaskMessageUserRole?taskID=' + taskID, apiConfig.create());
        },
        deleteWorkFlow: function (workflow) {
            return $http.post('/workflow/deleteWorkFlow', workflow, apiConfig.create());
        },

        
    };
}]);