// web service proxy for org
webservices.factory('orgService', ['$http', 'apiConfig', function ($http, apiConfig) {
    'use strict';
    return {
        getOrgList: function (type) {
            return $http.get('/org/display?useType=' + type, apiConfig.create());
        },
        getOrgListToJson: function (type) {
            return $http.get('/org/getjson?useType=' + type, apiConfig.create());
        },
        getOrgListForGrid: function () {
            return $http.get('/org/displayForGrid', apiConfig.create());
        },
        getSingleOrg: function (orgId) {
            return $http.get('/org/displaySingle?orgId=' + orgId, apiConfig.create());
        },
        addOrg: function (org) {
            return $http.post('/org/add', org, apiConfig.create());
        },
        updateOrg: function (org) {
            return $http.put('/org/update', org, apiConfig.create());
        },
        updateHierarchy: function (srcOrgID, destOrgID) {
            return $http.put('/org/updateHierarchy?srcOrgID=' + srcOrgID + '&destOrgID=' + destOrgID, org, apiConfig.create());
        },
        disableOrgs: function (orgList) {
            return $http.post('/org/disableOrgs', orgList, apiConfig.create());
        },
        deleteOrg: function (org) {
            return $http.post('/org/delete', org, apiConfig.create());
        },
        deleteOrgs: function (orgList) {
            return $http.post('/org/deleteOrgs', { orgList: orgList }, apiConfig.create());
        },
        getProjectIndustrys: function () {
            return $http.get('/org/getProjectIndustrys', apiConfig.create());
        },
        enableOrgs: function (id) {
            return $http.get('/org/enableOrgs?orgID=' + id, apiConfig.create());
        },
        getOrgIvhTreeList: function (useType, orgSetID) {
            return $http.get('/org/getOrgIvhTreeList?useType=' + useType + '&orgSetID=' + orgSetID, apiConfig.create());
        },
        getOrgDevTreeList: function (useType, orgSetID) {
            return $http.get('/org/getOrgDevTreeList?useType=' + useType + '&orgSetID=' + orgSetID, apiConfig.create());
        },
        codeUniqueValidate: function (id, viewValue) {
            return $http.post('/org/codeUniqueValidate', { Id: id, Value: viewValue }, apiConfig.create({ ignoreLoadingBar: true }));
        },
        taxPayerNumberUniqueValidate: function (id, viewValue) {
            return $http.post('/org/taxPayerNumberUniqueValidate', { Id: id, Value: viewValue }, apiConfig.create({ ignoreLoadingBar: true }));
        },
        getAreaStatistics: function () {
            return $http.get('/org/getAreaStatistics', apiConfig.create());
        },
        getOrgListForDashboard: function (orgID) {
            return $http.get('/org/getOrgListForDashboard?orgID=' + orgID, apiConfig.create({ ignoreLoadingBar: true }));
        },
        getOrgListFirstLevel: function () {
            return $http.get('/org/getOrgListFirstLevel', apiConfig.create());
        },
        getOrgAreaDashboard: function (dimensionValueID, parentDimensionID) {
            return $http.get('/org/getOrgAreaDashboard?dimensionValueID=' + dimensionValueID + '&parentDimensionID=' + parentDimensionID, apiConfig.create());
        },
        //getOrgBuDashboard: function (parentDimensionID) {
        //    return $http.get('/org/getOrgBuDashboard?parentDimensionID=' + parentDimensionID, apiConfig.create());
        //},
        getOrgCustomDashbord: function (dimensionValueID, parentDimensionID, attributeID) {
            return $http.get('/org/getOrgCustomDashbord?dimensionValueID=' + dimensionValueID + '&parentDimensionID=' + parentDimensionID + '&attributeID=' + attributeID, apiConfig.create());
        },
        getAreaOrganizationStaticsTreeList: function () {
            return $http.get('/org/getAreaOrganizationStaticsTreeList', apiConfig.create());
        },
        getOrgUserList: function (orgID) {
            return $http.get('/org/getOrgUserList?orgID=' + orgID, apiConfig.create({ ignoreLoadingBar: true }));
        },
        getOrgCityAreaUserCountList: function (orgID) {
            return $http.get('/org/getOrgCityAreaUserCountList?orgID=' + orgID, apiConfig.create({ ignoreLoadingBar: true }));
        },
        getGeneralInfo: function (orgID) {
            return $http.get('/org/getGeneralInfo?orgID=' + orgID, apiConfig.create({ ignoreLoadingBar: true }));
        },
        getOrgBuAreaIndustryUser: function (userID) {
            return $http.get('/org/getOrgBuAreaIndustryUser?userID=' + userID, apiConfig.create());
        },
        getOrgRoleListView: function (userID) {
            return $http.get('/org/getOrgRoleListView?userID=' + userID, apiConfig.create());
        },
        getOrgListCountDashboard: function (dimensionValueID, parentDimensionID) {
            return $http.get('/org/getOrgListCountDashboard?dimensionValueID=' + dimensionValueID + '&parentDimensionID=' + parentDimensionID, apiConfig.create({ ignoreLoadingBar: true }));
        },
        getOrgDashboard: function (dimensionID, parentOrgID, expandedOrgList) {
            return $http.post('/org/getOrgDashboard?dimensionID=' + dimensionID + '&parentOrgID=' + parentOrgID, expandedOrgList, apiConfig.create());
        },
        getOrgDashboardOnly: function (dimensionID, parentOrgID) {
            return $http.get('/org/getOrgDashboardOnly?dimensionID=' + dimensionID + '&parentOrgID=' + parentOrgID, apiConfig.create());
        },
        getBusinessUnitOrganizationStaticsTreeList: function () {
            return $http.get('/org/getBusinessUnitOrganizationStaticsTreeList', apiConfig.create());
        },
        getOrgListLevel: function () {
            return $http.get('/org/getOrgListLevel', apiConfig.create());
        },
        updateOrgToDimension: function (dimensionValueID, parentDimensionID, orgList) {
            return $http.post('/org/updateOrgToDimension', { dimensionValueID: dimensionValueID, dimensionID: parentDimensionID, orgDtoList: orgList }, apiConfig.create());
        },
        deleteUserDimensionValue: function (dimensionRoleDto, userID) {
            return $http.post('/org/deleteUserDimensionValue?userID=' + userID, dimensionRoleDto, apiConfig.create());
        },
        deleteUserOrg: function (orgRoleDto, userID) {
            return $http.post('/org/deleteUserOrg?userID=' + userID, orgRoleDto, apiConfig.create());
        },
        getOrganizationListByAreaID: function (areaID, attributeID) {
            return $http.get('/org/getOrganizationListByAreaID?areaID=' + areaID + '&attributeID=' + attributeID, apiConfig.create());
        },
        getOrganizationFilterList: function () {
            return $http.get('/org/getOrganizationFilterList', apiConfig.create());
        },
        getActiveOrganizationList: function () {
            return $http.get('/org/getActiveOrganizationList', apiConfig.create());
        },
        getGd: function () {
            return $http.get('/org/gd', apiConfig.create());
        },
        getBdList: function () {
            return $http.get('/org/bdList', apiConfig.create());
        }
    };
}]);