import request from "@/utils/httpRequest";
import { PSI_MANAGEMANT as prefix } from "../AppPath";

export default class FoodPurchaseService {
	list(params) {
		return request({
			url: prefix + "/psi/foodPurchase/list",
			method: "get",
			params,
		});
	}

	exportFile(params) {
		return request({
			url: prefix + "/psi/foodPurchase/exportFile",
			method: "get",
			params,
			responseType: "blob",
		});
	}

	save(data) {
		return request({
			url: prefix + "/psi/foodPurchase/save",
			method: "post",
			data,
		});
	}

	saveChange(data) {
		return request({
			url: prefix + "/psi/foodPurchase/saveChange",
			method: "post",
			data,
		});
	}

	approveChange(data) {
		return request({
			url: prefix + "/psi/foodPurchase/approveChange",
			method: "post",
			data,
		});
	}

	findById(id) {
		return request({
			url: prefix + "/psi/foodPurchase/findById",
			method: "get",
			params: { id },
		});
	}

	findChangeById(id) {
		return request({
			url: prefix + "/psi/foodPurchase/findChangeById",
			method: "get",
			params: { id },
		});
	}

	prepareChange(sourceBasicId) {
		return request({
			url: prefix + "/psi/foodPurchase/prepareChange",
			method: "get",
			params: { sourceBasicId },
		});
	}

	removeChange(id) {
		return request({
			url: prefix + "/psi/foodPurchase/removeChange",
			method: "get",
			params: { id },
		});
	}

	remove(id) {
		return request({
			url: prefix + "/psi/foodPurchase/remove",
			method: "get",
			params: { id },
		});
	}

	updateStatusById(data) {
		return request({
			url: prefix + "/psi/foodPurchase/updateStatusById",
			method: "post",
			data,
		});
	}

	updateChangeStatusById(data) {
		return request({
			url: prefix + "/psi/foodPurchase/updateChangeStatusById",
			method: "post",
			data,
		});
	}

	statistics(params) {
		return request({
			url: prefix + "/psi/foodPurchase/statistics",
			method: "get",
			params,
		});
	}
}
