import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CareerPlansVO, CareerPlansForm, CareerPlansQuery } from '@/api/ygpassport/careerPlans/types';

/**
 * 查询生涯规划相关信息列表
 * @param query
 * @returns {*}
 */

export const listCareerPlans = (query?: CareerPlansQuery): AxiosPromise<CareerPlansVO[]> => {
  return request({
    url: '/ygpassport/careerPlans/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询生涯规划相关信息详细
 * @param id
 */
export const getCareerPlans = (id: string | number): AxiosPromise<CareerPlansVO> => {
  return request({
    url: '/ygpassport/careerPlans/' + id,
    method: 'get'
  });
};

/**
 * 新增生涯规划相关信息
 * @param data
 */
export const addCareerPlans = (data: CareerPlansForm) => {
  return request({
    url: '/ygpassport/careerPlans',
    method: 'post',
    data: data
  });
};

/**
 * 修改生涯规划相关信息
 * @param data
 */
export const updateCareerPlans = (data: CareerPlansForm) => {
  return request({
    url: '/ygpassport/careerPlans',
    method: 'put',
    data: data
  });
};

/**
 * 删除生涯规划相关信息
 * @param id
 */
export const delCareerPlans = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/careerPlans/' + id,
    method: 'delete'
  });
};
