import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CareerSkillVO, CareerSkillForm, CareerSkillQuery } from '@/api/ygpassport/careerSkill/types';

/**
 * 查询职业技能证书列表
 * @param query
 * @returns {*}
 */

export const listCareerSkill = (query?: CareerSkillQuery): AxiosPromise<CareerSkillVO[]> => {
  return request({
    url: '/ygpassport/careerSkill/listNew',
    method: 'get',
    params: query
  });
};

/**
 * 查询职业技能证书详细
 * @param id
 */
export const getCareerSkill = (id: string | number): AxiosPromise<CareerSkillVO> => {
  return request({
    url: '/ygpassport/careerSkill/' + id,
    method: 'get'
  });
};

/**
 * 新增职业技能证书
 * @param data
 */
export const addCareerSkill = (data: CareerSkillForm) => {
  return request({
    url: '/ygpassport/careerSkill',
    method: 'post',
    data: data
  });
};

/**
 * 修改职业技能证书
 * @param data
 */
export const updateCareerSkill = (data: CareerSkillForm) => {
  return request({
    url: '/ygpassport/careerSkill',
    method: 'put',
    data: data
  });
};

/**
 * 删除职业技能证书
 * @param id
 */
export const delCareerSkill = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/careerSkill/' + id,
    method: 'delete'
  });
};
