import request from '/@/utils/request';

export function startBidFileFlow(purchaseId: string) {
	return request({
		url: '/purchase/purchasingbidfile/startFlow',
		method: 'post',
		params: { purchaseId },
	});
}

export function getBidFileTodoList(pageNum: number, pageSize: number) {
	return request({
		url: '/purchase/purchasingbidfile/todoList',
		method: 'get',
		params: { pageNum, pageSize },
	});
}

export function getBidFileTaskDetail(runJobId: string) {
	return request({
		url: '/purchase/purchasingbidfile/taskDetail',
		method: 'get',
		params: { runJobId },
	});
}

export function agentUploadBidFile(data: {
	purchaseId: string;
	fileId: string;
	fileName: string;
	fileUrl: string;
	comment?: string;
	runJobId: string;
}) {
	return request({
		url: '/purchase/purchasingbidfile/agentUpload',
		method: 'post',
		params: data,
	});
}

export function assetUploadBidFile(data: {
	purchaseId: string;
	fileId: string;
	fileName: string;
	fileUrl: string;
	comment?: string;
	runJobId: string;
}) {
	return request({
		url: '/purchase/purchasingbidfile/assetUpload',
		method: 'post',
		params: data,
	});
}

export function uploadBidFileNewVersion(data: {
	purchaseId: string;
	fileId: string;
	fileName: string;
	fileUrl: string;
	comment?: string;
	runJobId: string;
}) {
	return request({
		url: '/purchase/purchasingbidfile/uploadNewVersion',
		method: 'post',
		params: data,
	});
}

export function submitBidFileTask(data: { runJobId: string; to?: number; comment?: string }) {
	return request({
		url: '/purchase/purchasingbidfile/submit',
		method: 'post',
		params: data,
	});
}

export function confirmBidFileFinalize(runJobId: string) {
	return request({
		url: '/purchase/purchasingbidfile/confirmFinalize',
		method: 'post',
		params: { runJobId },
	});
}

export function getBidFileVersionHistory(purchaseId: string) {
	return request({
		url: '/purchase/purchasingbidfile/versionHistory',
		method: 'get',
		params: { purchaseId },
	});
}

export function getBidFileCurrentVersion(purchaseId: string) {
	return request({
		url: '/purchase/purchasingbidfile/currentVersion',
		method: 'get',
		params: { purchaseId },
	});
}

export function getAgentPurchaseDetail(purchaseId: string) {
	return request({
		url: '/purchase/purchasingbidfile/agentPurchaseDetail',
		method: 'get',
		params: { purchaseId },
	});
}

export function getFlowPurchaseDetail(purchaseId: string) {
	return request({
		url: '/purchase/purchasingbidfile/flowPurchaseDetail',
		method: 'get',
		params: { purchaseId },
	});
}

export function tempStoreBidFile(data: { purchaseId: string; fileId?: string; fileName?: string; fileUrl?: string; comment?: string }) {
	return request({
		url: '/purchase/purchasingbidfile/tempStore',
		method: 'post',
		data,
	});
}

export function submitBidFile(purchaseId: string) {
	return request({
		url: '/purchase/purchasingbidfile/submitFile',
		method: 'post',
		params: { purchaseId },
	});
}
