import { OpenAPIHono } from "@hono/zod-openapi";

import mgtEvents from "./route/mgtEvents.js";
import tagInfo from "./route/tagInfo.js";
import addReader from "./route/addReader.js";
import updateReader from "./route/updateReader.js";
import manualTrigger from "./route/manualTagRead.js";
import getReaders from "./route/getReaders.js";
import resetRatio from "./route/resetRatio.js";
import { monitorRfidTags } from "./utils/monitorTags.js";
const app = new OpenAPIHono();

const routes = [
    mgtEvents,
    tagInfo,
    addReader,
    updateReader,
    manualTrigger,
    getReaders,
    resetRatio,
] as const;

// app.route("/server", modules);
const appRoutes = routes.forEach((route) => {
    app.route("/rfid", route);
});

// monitor every 5 min tags older than 6 hours to remove the line they were so we reduce the risk of them being labeled with the wrong info
setInterval(() => {
    monitorRfidTags();
}, 5 * 1000 * 60);

export default app;
