import { request } from '/@/utils/service';
import { UserPageQuery, AddReq, DelReq, EditReq, InfoReq,PageQuery } from '@fast-crud/fast-crud';

/* 获取胜任力标签 */
export function GetCompetencyList(query: UserPageQuery) {
	return request({
		url: '/api/system/competency/list',
		method: 'get',
		params: {...query,tenant_id:1},
	});
}
/* 获取题库列表 */
export function GetQuestionList(query: PageQuery) {
	return request({
		url: '/api/system/interview_question/list',
		method: 'get',
		params: {...query,tenant_id:1},/* :Session.get('tenant_id').tenant_id || ,tenant_id:'1' */
	});
}
/* 根据职位及胜任力标签生成题目 */

export function GenerateQuestions(obj: AddReq) {
	return request({
		url: '/api/admin/interview/questions/generate',
		method: 'post',
		data: {...obj,tenant_id:1},
        timeout: 0
	});
}
/* 获取生成题目的列表 */
export function GetDraftList(obj: EditReq) {
	return request({
		url: `/api/system/interview_question/draft_list?tenant_id=${obj.tenant_id}&position_id=${obj.position_id}`,
		method: 'get',
	});
}

/* 暂存生成的题目 */
export function SaveDraft(obj: EditReq) {
	return request({
		url: `/api/system/interview_question/confirm_draft`,
		method: 'post',
		data: {...obj,tenant_id:1},
	});
}
/* 获取数字人列表 */
export function GetDigitalList(obj: EditReq) {
	return request({
		url: `/api/system/digital_human/`,
		method: 'get',
		params: {...obj,tenant_id:1},
	});
}

/* 创建配置 */
export function CreateConfig(data:any) {
	return request({
		url:`/api/system/job_config/list`,
		method: 'post',
		data: {...data,tenant_id:1},
	});
}
/* 更新配置 */
export function UpdateConfig(data:any) {
	return request({
		url:`/api/system/job_config/detail/${data.id}`,
		method: 'put',
		data: {...data,tenant_id:1},
	});
}
/* 获取当前配置 */
export function GetConfig(id:any) {
	return request({
		url:`/api/system/job_config/position/detail/${id}`,
		method: 'get',
		
	});
}

export function DelObj(data:any) {
	return request({
		url:`/api/system/competency/delete`,
		method: 'post',
		data: {...data,tenant_id:1},
	});
}
export function GetPermission(query: UserPageQuery) {
    return request({
        url: '/api/system/competency/list',
        method: 'get',
        params: {...query,tenant_id:1},
    });
}

export function GetcategoryList(query: UserPageQuery) {
	return request({
		url: '/api/system/question_category/list',
		method: 'get',
		params: {...query,tenant_id:1},
	});
}

export function GetPositionList(query: UserPageQuery) {
	return request({
		url: '/api/system/job/list',
		method: 'get',
		params: {...query,tenant_id:1},
	});
}
