import Axios from 'axios'
import {AUTHORITY_ADMQ, AUTHORITY_CONFIG, REQUEST_CONFIG} from "../../utils/RequestUrls"

var staticMethods = {
  //获取全部权限集合
  getAllAuthorityCollection: function () {
    return Axios.get(AUTHORITY_ADMQ)
  },

  //获取用户组配置
  getUserGroupConfig: function () {
    return Axios.get(AUTHORITY_CONFIG)
  },

  //创建用户组
  postAddUserGroup: function (userGroup) {
    return Axios.post(AUTHORITY_CONFIG, userGroup, REQUEST_CONFIG)
  },

  //删除用户组
  deleteDeleteUserGroup: function (userGroupKeyList) {
    return Axios.delete(AUTHORITY_CONFIG,{
      data:userGroupKeyList,
      headers:{'Content-Type':'application/json','Encoding':'utf-8'}
    });
  },

  //修改用户组
  putModifyUserGroup: function (userGroup) {
    return Axios.put(AUTHORITY_CONFIG, userGroup, REQUEST_CONFIG)
  },

  //条件查询用户组
  putConditionQueryUserGroup: function (conditionSet) {
    return Axios.put(AUTHORITY_CONFIG, conditionSet, REQUEST_CONFIG)
  }
}

function UserGroupAPI (websocketService = null) {
  return Object.freeze(Object.assign(
    {
      // object methods comes here
    },
    staticMethods
  ))
}

Object.assign(UserGroupAPI, staticMethods)
export default UserGroupAPI
