// an external way to creating logs
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { apiHit } from "../../../globalUtils/apiHits.js";
import { responses } from "../../../globalUtils/routeDefs/responses.js";
import materialPerDayCheck from "../controller/materialsPerDay/materialPerDay.js";
import fifoIndexCheck from "../controller/notifications/fifoIndex.js";

const app = new OpenAPIHono({ strict: false });

app.openapi(
	createRoute({
		tags: ["notify"],
		summary: "",
		method: "get",
		path: "/materialperday",
		//middleware: authMiddleware,
		responses: responses(),
	}),
	async (c) => {
		/**
		 * get the blocking notification stuff
		 */
		apiHit(c, { endpoint: "/materialperday" });

		/**
		 * getting the shipped pallets
		 */
		const checkedData = await materialPerDayCheck();

		return c.json({
			success: checkedData.success,
			message: checkedData.message,
			data: checkedData.data,
		});
	},
);
export default app;
