import request from "@/utils/request";

// 获取服务授权列表
export function getSysAuthAll() {
  return request({
    url: "/erp/sysAuthAccount/all"
  });
}

/**
 * 新增服务授权
 * @param {*} data  {"account": 账号,  authModules: [], enabled: true, "remark":"备注"}
 * @returns 
 */
export function addSysAuth(data) {
  return request({
    url: "/erp/sysAuthAccount",
    method: "POST",
    data: data
  });
}

/**
 * 修改服务授权
 * @param {*} data {authAccountId 服务授权id, "account": 账号,  authModules: [], enabled: true, "remark":"备注"}
 * @returns 
 */
export function updateSysAuth(props) {
  let { authAccountId, ...data } = props
  return request({
    url: `/erp/sysAuthAccount/${authAccountId}`,
    method: "PUT",
    data: data
  });
}

/**
 * 删除服务授权
 * @param {*} authAccountId 
 * @returns 
 */
export function delSysAuth(authAccountId) {
    return request({
      url: `/erp/sysAuthAccount/${authAccountId}`,
      method: "DELETE"
    });
  }