import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ForeignLanguageSkillVO, ForeignLanguageSkillForm, ForeignLanguageSkillQuery } from '@/api/ygpassport/foreignLanguageSkill/types';

/**
 * 查询外语能力水平列表
 * @param query
 * @returns {*}
 */

export const listForeignLanguageSkill = (query?: ForeignLanguageSkillQuery): AxiosPromise<ForeignLanguageSkillVO[]> => {
  return request({
    url: '/ygpassport/foreignLanguageSkill/listNew',
    method: 'get',
    params: query
  });
};

/**
 * 查询外语能力水平详细
 * @param id
 */
export const getForeignLanguageSkill = (id: string | number): AxiosPromise<ForeignLanguageSkillVO> => {
  return request({
    url: '/ygpassport/foreignLanguageSkill/' + id,
    method: 'get'
  });
};

/**
 * 新增外语能力水平
 * @param data
 */
export const addForeignLanguageSkill = (data: ForeignLanguageSkillForm) => {
  return request({
    url: '/ygpassport/foreignLanguageSkill',
    method: 'post',
    data: data
  });
};

/**
 * 修改外语能力水平
 * @param data
 */
export const updateForeignLanguageSkill = (data: ForeignLanguageSkillForm) => {
  return request({
    url: '/ygpassport/foreignLanguageSkill',
    method: 'put',
    data: data
  });
};

/**
 * 删除外语能力水平
 * @param id
 */
export const delForeignLanguageSkill = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/foreignLanguageSkill/' + id,
    method: 'delete'
  });
};
