import request from '@/utils/request';

export function getModulesList() {
  return request({
    url: '/backend/modules/list',
    method: 'get',
  });
}

export function getTenantList() {
  return request({
    url: '/backend/modules/getTenantList',
    method: 'get',
  });
}

export function getModuleDetail(id) {
  return request({
    url: `/backend/modules/${id}`,
    method: 'get',
  });
}

export function addModule(data) {
  return request({
    url: '/backend/modules',
    method: 'post',
    data,
  });
}

export function editModule(id, data) {
  return request({
    url: `/backend/modules/${id}`,
    method: 'put',
    data,
  });
}

export function deleteModule(id) {
  return request({
    url: `/backend/modules/${id}`,
    method: 'delete',
  });
}

export function batchDeleteModules(ids) {
  return request({
    url: '/backend/modules/batchDelete',
    method: 'post',
    data: { ids },
  });
}

export function changeModuleStatus(id, status) {
  return request({
    url: '/backend/modules/status',
    method: 'post',
    data: { id, status },
  });
}

export function getModulesSelectList() {
  return request({
    url: '/backend/modules/select/list',
    method: 'get',
  });
}
