import request from '@/utils/request';

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

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

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

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

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

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

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

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

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