import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ScoreplanVO, ScoreplanForm, ScoreplanQuery } from '@/api/ygpassport/scoreplan/types';

/**
 * 查询个人目标与成长计划列表
 * @param query
 * @returns {*}
 */

export const listScoreplan = (query?: ScoreplanQuery): AxiosPromise<ScoreplanVO[]> => {
  return request({
    url: '/system/scoreplan/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询个人目标与成长计划详细
 * @param id
 */
export const getScoreplan = (id: string | number): AxiosPromise<ScoreplanVO> => {
  return request({
    url: '/system/scoreplan/' + id,
    method: 'get'
  });
};

/**
 * 新增个人目标与成长计划
 * @param data
 */
export const addScoreplan = (data: ScoreplanForm) => {
  return request({
    url: '/system/scoreplan',
    method: 'post',
    data: data
  });
};

/**
 * 修改个人目标与成长计划
 * @param data
 */
export const updateScoreplan = (data: ScoreplanForm) => {
  return request({
    url: '/system/scoreplan',
    method: 'put',
    data: data
  });
};

/**
 * 删除个人目标与成长计划
 * @param id
 */
export const delScoreplan = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/scoreplan/' + id,
    method: 'delete'
  });
};
