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

/**
 * 分页查询活动子项目列表
 * @param query
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/activityinfosub/page',
    method: 'get',
    params: query
  });
};

/**
 * 获取活动主题列表
 */
export const getActivityInfoList = () => {
  return request({
    url: '/stuwork/activityinfo/activityInfoList',
    method: 'get'
  });
};

/**
 * 查看详情 - 根据活动ID获取活动子项目列表
 * 接口文档：GET /api/stuwork/activityinfosub/getActivityInfoSubList
 * @param activityInfoId 活动信息ID
 */
export const getActivityInfoSubList = (activityInfoId: string) => {
  return request({
    url: '/stuwork/activityinfosub/getActivityInfoSubList',
    method: 'get',
    params: { activityInfoId }
  });
};

/**
 * 删除活动子项目
 * @param ids
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/activityinfosub',
    method: 'delete',
    data: ids
  });
};

/**
 * 活动报名
 * @param data 报名信息 { activityInfoId, id (子项目ID), remarks }
 */
export const signUp = (data: any) => {
  return request({
    url: '/stuwork/activityinfosub/signUp',
    method: 'post',
    data
  });
};

