import { addProject, deleteProject, getProjects, pushProjectConfiguration, selectProject, unselectProject, updateProject, updateProjectMembers } from "../controllers/project.controller.mjs";
import { addNewAccessKey, deleteAccessKey, refreshAccessKey } from "../controllers/projectAccessKey.controller.mjs";
import { Router } from "express";

//#region src/routes/project.routes.ts
const projectRouter = Router();
const projectRoute = "/api/project";
const baseURL = () => `${process.env.BACKEND_URL}${projectRoute}`;
const getProjectRoutes = () => ({
	getProjects: {
		urlModel: "/",
		url: baseURL(),
		method: "GET"
	},
	addProject: {
		urlModel: "/",
		url: baseURL(),
		method: "POST"
	},
	updateProject: {
		urlModel: "/",
		url: baseURL(),
		method: "PUT"
	},
	updateProjectMembers: {
		urlModel: "/members",
		url: `${baseURL()}/members`,
		method: "PUT"
	},
	pushProjectConfiguration: {
		urlModel: "/configuration",
		url: `${baseURL()}/configuration`,
		method: "PUT"
	},
	deleteProject: {
		urlModel: "/",
		url: baseURL(),
		method: "DELETE"
	},
	selectProject: {
		urlModel: "/:projectId",
		url: ({ projectId }) => `${baseURL()}/${projectId}`,
		method: "PUT"
	},
	unselectProject: {
		urlModel: "/logout",
		url: `${baseURL()}/logout`,
		method: "POST"
	},
	addNewAccessKey: {
		urlModel: "/access_key",
		url: `${baseURL()}/access_key`,
		method: "POST"
	},
	refreshAccessKey: {
		urlModel: "/access_key",
		url: `${baseURL()}/access_key`,
		method: "PATCH"
	},
	deleteAccessKey: {
		urlModel: "/access_key",
		url: `${baseURL()}/access_key`,
		method: "DELETE"
	}
});
projectRouter.get(getProjectRoutes().getProjects.urlModel, getProjects);
projectRouter.post(getProjectRoutes().addProject.urlModel, addProject);
projectRouter.put(getProjectRoutes().updateProject.urlModel, updateProject);
projectRouter.put(getProjectRoutes().updateProjectMembers.urlModel, updateProjectMembers);
projectRouter.put(getProjectRoutes().pushProjectConfiguration.urlModel, pushProjectConfiguration);
projectRouter.delete(getProjectRoutes().deleteProject.urlModel, deleteProject);
projectRouter.post(getProjectRoutes().addNewAccessKey.urlModel, addNewAccessKey);
projectRouter.patch(getProjectRoutes().refreshAccessKey.urlModel, refreshAccessKey);
projectRouter.delete(getProjectRoutes().deleteAccessKey.urlModel, deleteAccessKey);
projectRouter.post(getProjectRoutes().unselectProject.urlModel, unselectProject);
projectRouter.put(getProjectRoutes().selectProject.urlModel, selectProject);

//#endregion
export { getProjectRoutes, projectRoute, projectRouter };
//# sourceMappingURL=project.routes.mjs.map