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

/**
 * 分页查询教室列表
 * @param query
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/teachclassroom/page',
    method: 'get',
    params: query
  });
};

/**
 * 获取教室列表（不分页）
 */
export const getClassRoomList = () => {
  return request({
    url: '/stuwork/teachclassroom/list',
    method: 'get'
  });
};

/**
 * 新增教室
 * @param data
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/teachclassroom',
    method: 'post',
    data
  });
};

/**
 * 获取详情
 * @param id
 */
export const getDetail = (id: string) => {
  return request({
    url: '/stuwork/teachclassroom/detail',
    method: 'get',
    params: { id }
  });
};

/**
 * 编辑教室
 * @param data
 */
export const editObj = (data: any) => {
  return request({
    url: '/stuwork/teachclassroom/edit',
    method: 'post',
    data
  });
};

/**
 * 删除教室
 * @param ids
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/teachclassroom/delete',
    method: 'post',
    data: ids
  });
};

/**
 * 批量设置（批量更新选中教室的学院）
 * @param data 数组格式，每个元素包含 id（教室ID）和 deptCode（学院代码）
 */
export const batchSet = (data: any[]) => {
  return request({
    url: '/stuwork/teachclassroom/putDeptList',
    method: 'post',
    data
  });
};

