import { request } from '/@/utils/service';

const apiPrefix = '/api/pricing/price_product_direct/';

export function getTableData(query: any) {
	return request({
		url: apiPrefix,
		method: 'GET',
		params: query
	});
}

export function updateRow(body: any) {
	return request({
		url: apiPrefix + body.id + '/',
		method: 'PUT',
		data: body,
		params: {
			partial: 1
		}
	});
}

export function deleteRow(body: any) {
	return request({
		url: apiPrefix + `${body.id}/` ,
		method: 'DELETE',
		data: body
	});
}

export function getOptions(query: any) {
	return request({
		url: '/api/pricing/price_cost/price_product_direct/box/',
		method: 'GET',
		params: query
	});
}

export function exportData(query: any) {
	return request({
		url: apiPrefix + 'export_data/',
		method: 'GET',
		responseType: 'blob',
		params: query
	});
}

export function upload(body: any){
	return request({
		url: apiPrefix +'import_data/',
		method: 'POST',
		data: body,
	});
}