import type { Express } from "express";
import { featureCheck } from "../middleware/featureActive.middleware.js";
import activeLoadingOrders from "./dockdoor.activeLoadingOrders.route.js";
import closeLoadingOrder from "./dockdoor.closeLoadingOrder.route.js";
import load from "./dockdoor.loadUnits.route.js";
import startLoad from "./dockdoor.startLoad.route.js";
import prodDocks from "./dockdoors.docks.route.js";
import docks from "./dockdoors.route.js";

export const setupDockDoorRoutes = (baseUrl: string, app: Express) => {
	//stats will be like this as we dont need to change this

	app.use(
		`${baseUrl}/api/dockDoor/scanners`,
		featureCheck("dockDoorScanning"),

		docks,
	);

	app.use(
		`${baseUrl}/api/dockDoor/finishOrder`,
		featureCheck("dockDoorScanning"),
		closeLoadingOrder,
	);
	app.use(
		`${baseUrl}/api/dockDoor/activeLoadingOrders`,
		featureCheck("dockDoorScanning"),
		activeLoadingOrders,
	);
	app.use(
		`${baseUrl}/api/dockDoor/startLoad`,
		featureCheck("dockDoorScanning"),
		startLoad,
	);
	app.use(
		`${baseUrl}/api/dockDoor/docks`,
		featureCheck("dockDoorScanning"),
		prodDocks,
	);

	app.use(
		`${baseUrl}/api/dockDoor/loadUnit`,
		featureCheck("dockDoorScanning"),
		load,
	);

	// all other system should be under /api/system/*
};
