import request from '@/utils/request';

/*
 * 分页查询
 */
export const getTaCheckItem = (params) => request('/api/taCheckItem', { params });

/*
 * 新增数据
 */
export const postTaCheckItem = (data) => request('/api/taCheckItem', { data, method: 'post' });

/*
 * 通过ID查询单条数据
 */
export const getTaCheckItemById = (id) => request(`/api/taCheckItem/${id}`);

/**
 * 更新数据
 * @param {*} id
 * @param {*} data
 * @returns
 */
export const putTaCheckItem = (id, data) => request(`/api/taCheckItem/${id}`, { data, method: 'put' });

/*
 * 通过主键删除数据
 */
export const deleteTaCheckItem = (id) => request(`/api/taCheckItem/${id}`, { method: 'delete' });

export const preCheck = (id, opts = {}) => request(`/api/taCheckItem/${id}/answer/pre-check`, { method: 'put', ...opts });

/*
 * 获取当前答案
 */
export const getTaCheckItemAnswer = (id) => request(`/api/taCheckItem/${id}/answer`);

/*
 * 获取当前答案
 */
export const putTaCheckItemAnswer = (id, data) => request(`/api/taCheckItem/${id}/answer`, { method: 'put', data });

/*
 * 通过测评ID获取测评ITEM
 */
export const getTaCheckItemByCheck = (checkId, typ) => request(`/api/taCheck/${checkId}/item/${typ}`);