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

export const apiPrefix = '/api/system/job/create';

export function GetPermission() {
	return request({
		url: apiPrefix + 'field_permission/',
		method: 'get',
	});
}

export function GetList(query: PageQuery) {
	return request({
		url: '/api/system/job/list',
		method: 'get',
		params: {...query,tenant_id:'1'},/* :Session.get('tenant_id').tenant_id ||  */
	});
}
export function GetObj(id: InfoReq) {
	return request({
		url: "/api/system/job/detail?id=" + id+"&tenant_id=1",
		method: 'get',
	});
}

export function AddObj(obj: AddReq) {
	return request({
		url: "/api/system/job/create",
		method: 'post',
		data: {...obj,tenant_id: '1'},/* Session.get('tenant_id').tenant_id || */
	});
}

export function UpdateObj(obj: EditReq) {
	return request({
		url: "/api/system/job/update",/* + obj.id+'/' */
		method: 'post',
		data: {...obj,tenant_id: '1'},
	});
}

export function DelObj(id: DelReq) {
	return request({
		url: '/api/system/job/delete',/* + id + '/' */
		method: 'delete',
		data: { id,tenant_id: '1' },
	});
}

export function BatchUpdateTags(data: any) {
	return request({
		url: '/api/system/competency/batch_bind',
		method: 'post',
		data
	});
}

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