import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StudentAlbumVO, StudentAlbumForm, StudentAlbumQuery } from '@/api/ygpassport/studentAlbum/types';

/**
 * 查询学生相册列表
 * @param query
 * @returns {*}
 */

export const listStudentAlbum = (query?: StudentAlbumQuery): AxiosPromise<StudentAlbumVO[]> => {
  return request({
    url: '/ygpassport/studentAlbum/allList',
    method: 'get',
    params: query
  });
};

/**
 * 查询学生相册详细
 * @param id
 */
export const getStudentAlbum = (id: string | number): AxiosPromise<StudentAlbumVO> => {
  return request({
    url: '/ygpassport/studentAlbum/' + id,
    method: 'get'
  });
};

/**
 * 新增学生相册
 * @param data
 */
export const addStudentAlbum = (data: StudentAlbumForm) => {
  return request({
    url: '/ygpassport/studentAlbum',
    method: 'post',
    data: data
  });
};

/**
 * 修改学生相册
 * @param data
 */
export const updateStudentAlbum = (data: StudentAlbumForm) => {
  return request({
    url: '/ygpassport/studentAlbum',
    method: 'put',
    data: data
  });
};

/**
 * 删除学生相册
 * @param id
 */
export const delStudentAlbum = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/studentAlbum/' + id,
    method: 'delete'
  });
};
