/*
 * @Author: zjq
 * @description 我的培训
 */
import request from '@/utils/request';

/**
 * @description 获取培训列表
 * @param {object} params
 */
export const getUserTrainData = (params?: object) => {
    return request({
        url: '/api/v1/TrainRecord/GetPagedList',
        method: 'post',
        data: params,
    });
};

/**
 * @description 获取培训详情
 * @param {any} Id
 */
export const getTrainInfo = (Id: any) => {
    return request({
        url: `/api/v1/TrainRecord/Get`,
        method: 'post',
        data: {
            id: Id
        }
    });
};

/**
 * @description 提交培训习题
 * @param {object} data
 */
export const answerUserTrain = (data: object) => {
    return request({
        url: '/api/v1/TrainRecord/Train',
        method: 'post',
        data,
    });
};

/**
 * @description 获取培训试题详情
 * @param {any} Id
 */
export const getTrainQuestion = (Id: any, TrainPracticeId: any) => {
    return request({
        url: `/api/v1/TrainRecord/GetTrainPractice?Id=${Id}&TrainPracticeId=${TrainPracticeId}`,
        method: 'get',
    });
};

/**
 * @description 结束培训
 * @param {object} params
 */
export const submitUserTrain = (params?: object) => {
    return request({
        url: '/api/v1/TrainRecord/CompleteTrainRecord',
        method: 'post',
        data: params,
    });
};