import request from '@/utils/request';

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

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

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

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

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

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

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

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