import request from '/@/utils/request';

/**
 * 分页查询宿舍卫生评比规则列表
 * @param query 查询参数
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/dormhygieneevalrule/page',
    method: 'get',
    params: query
  });
};

/**
 * 获取所有启用的规则
 */
export const getEnabledRules = () => {
  return request({
    url: '/stuwork/dormhygieneevalrule/list',
    method: 'get'
  });
};

/**
 * 通过id查询详情
 * @param id 主键ID
 */
export const getDetail = (id: string) => {
  return request({
    url: '/stuwork/dormhygieneevalrule/detail',
    method: 'get',
    params: { id }
  });
};

/**
 * 新增评比规则
 * @param data 数据对象
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/dormhygieneevalrule',
    method: 'post',
    data
  });
};

/**
 * 修改评比规则
 * @param data 数据对象
 */
export const editObj = (data: any) => {
  return request({
    url: '/stuwork/dormhygieneevalrule/edit',
    method: 'post',
    data
  });
};

/**
 * 删除评比规则
 * @param ids ID数组
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/dormhygieneevalrule/delete',
    method: 'post',
    data: ids
  });
};