import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StudentLeaderExperienceVO, StudentLeaderExperienceForm, StudentLeaderExperienceQuery } from '@/api/ygpassport/studentLeaderExperience/types';

/**
 * 查询学生干部经历列表
 * @param query
 * @returns {*}
 */

export const listStudentLeaderExperience = (query?: StudentLeaderExperienceQuery): AxiosPromise<StudentLeaderExperienceVO[]> => {
  return request({
    url: '/ygpassport/studentLeaderExperience/listNew',
    method: 'get',
    params: query
  });
};

/**
 * 查询学生干部经历详细
 * @param id
 */
export const getStudentLeaderExperience = (id: string | number): AxiosPromise<StudentLeaderExperienceVO> => {
  return request({
    url: '/ygpassport/studentLeaderExperience/' + id,
    method: 'get'
  });
};

/**
 * 新增学生干部经历
 * @param data
 */
export const addStudentLeaderExperience = (data: StudentLeaderExperienceForm) => {
  return request({
    url: '/ygpassport/studentLeaderExperience',
    method: 'post',
    data: data
  });
};

/**
 * 修改学生干部经历
 * @param data
 */
export const updateStudentLeaderExperience = (data: StudentLeaderExperienceForm) => {
  return request({
    url: '/ygpassport/studentLeaderExperience',
    method: 'put',
    data: data
  });
};

/**
 * 删除学生干部经历
 * @param id
 */
export const delStudentLeaderExperience = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/studentLeaderExperience/' + id,
    method: 'delete'
  });
};
