import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ExtracActivitiesVO, ExtracActivitiesForm, ExtracActivitiesQuery } from '@/api/ygpassport/extracActivities/types';

/**
 * 查询第二课堂活动记录列表
 * @param query
 * @returns {*}
 */

export const listExtracActivities = (query?: ExtracActivitiesQuery): AxiosPromise<ExtracActivitiesVO[]> => {
  return request({
    url: '/ygpassport/extracActivities/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询第二课堂活动记录详细
 * @param id
 */
export const getExtracActivities = (id: string | number): AxiosPromise<ExtracActivitiesVO> => {
  return request({
    url: '/ygpassport/extracActivities/' + id,
    method: 'get'
  });
};

/**
 * 新增第二课堂活动记录
 * @param data
 */
export const addExtracActivities = (data: ExtracActivitiesForm) => {
  return request({
    url: '/ygpassport/extracActivities',
    method: 'post',
    data: data
  });
};

/**
 * 修改第二课堂活动记录
 * @param data
 */
export const updateExtracActivities = (data: ExtracActivitiesForm) => {
  return request({
    url: '/ygpassport/extracActivities',
    method: 'put',
    data: data
  });
};

/**
 * 删除第二课堂活动记录
 * @param id
 */
export const delExtracActivities = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/extracActivities/' + id,
    method: 'delete'
  });
};
