import {
  deleteRoleInfoType,
  getCompanyInfoByIdType,
  getSecondDistrictInfo,
  insertBAccountType,
  insertRoleInfoType,
  listBAccountPageType,
  listCompanyAdd,
  listCompanyMembersType,
  listCompanyPage,
  listCompanyRemove,
  listCompanyUpdate,
  listMenuInfoType,
  listRoleInfoPageType,
  listRoleMenuInfoType,
  removeBAccountType,
  updateBAccountType,
  updatePasswordType,
  updateRoleInfoType,
  updateRoleMenuInfoType,
} from '../interface/systemManageType';
import axios from '../request';

export class SystemManageAPI {
  // 账号-列表
  static listBAccountPage: listBAccountPageType = (params) =>
    axios.post('/userapp/back-user/listBAccountPage', params);

  // 账号-新增
  static insertBAccount: insertBAccountType = (params) =>
    axios.post('/userapp/back-user/insertBAccount', params);

  // 账号-删除(后台)
  static removeBAccountBack: removeBAccountType = (params) =>
    axios.get('/userapp/back-user/removeBAccount', { params });

  // 账号-删除(小程序)
  static removeBAccount: removeBAccountType = (params) =>
    axios.get('/userapp/user-account/removeAppAccount', { params });

  // 账号-修改
  static updateBAccount: updateBAccountType = (params) =>
    axios.post('/userapp/back-user/updateBAccount', params);

  // 账号-修改密码
  static updatePassword: updatePasswordType = (params) =>
    axios.post('/userapp/back-user/updatePassword', params);

  // 单位-列表
  static listCompanyPage: listCompanyPage = (params) =>
    axios.post('/userapp/company/listCompanyPage', params);

  // 单位-新增
  static listCompanyAdd: listCompanyAdd = (params) => axios.post('/userapp/company/add', params);

  // 单位-修改
  static listCompanyUpdate: listCompanyUpdate = (params) =>
    axios.post('/userapp/company/update', params);

  // 单位-删除
  static listCompanyRemove: listCompanyRemove = (params) =>
    axios.get('/userapp/company/remove', { params });
  //单位-详情
  static getCompanyInfoById: getCompanyInfoByIdType = (params) =>
    axios.get('/userapp/company/getCompanyInfoById', { params });

  // 单位-区域
  static getSecondDistrictInfo: getSecondDistrictInfo = (params) =>
    axios.get('/pms/webDevice/getSecondDistrictInfo', { params });
  //单位-成员列表
  static getListCompanyMembers: listCompanyMembersType = (params) =>
    axios.get('/userapp/company/listCompanyMembers', { params });

  //账号权限-列表
  static getListRoleInfoPage: listRoleInfoPageType = (data) =>
    axios.post('/userapp/role/listRoleInfoPage', data);

  //  账号权限-新增
  static insertRoleInfo: insertRoleInfoType = (data) =>
    axios.post('/userapp/role/insertRoleInfo', data);
  //  账号权限-编辑
  static updateRoleInfo: updateRoleInfoType = (data) =>
    axios.post('/userapp/role/updateRoleInfo', data);
  //  账号权限-删除
  static deleteRoleInfo: deleteRoleInfoType = (params) =>
    axios.get('/userapp/role/removeRoleInfo', { params });
  //  账号权限-全部菜单列表
  static getListMenuInfo: listMenuInfoType = () => axios.get('/userapp/role-menu/listMenuInfo');
  //  账号权限-根据角色id获取权限
  static getListRoleMenuInfo: listRoleMenuInfoType = (params) =>
    axios.get('/userapp/role/listRoleMenuInfo', { params });
  //账号权限-修改角色菜单权限
  static updateRoleMenuInfo: updateRoleMenuInfoType = (data) =>
    axios.post('/userapp/role/updateRoleMenuInfo', data);
}
