import { type Express, Router } from "express";
import { requireAuth } from "../middleware/auth.middleware.js";
import { featureCheck } from "../middleware/featureActive.middleware.js";
import getApt from "./opendockGetRelease.route.js";

export const setupOpendockRoutes = (baseUrl: string, app: Express) => {
	//setup all the routes
	// Apply auth to entire router
	const router = Router();

	// is the feature even on?
	router.use(featureCheck("opendock_sync"));

	// we need to make sure we are authenticated to see the releases
	router.use(requireAuth);

	router.use(getApt);
	app.use(`${baseUrl}/api/opendock`, router);
};
