import { addOrganization, addOrganizationMember, deleteOrganization, getOrganizations, selectOrganization, unselectOrganization, updateOrganization, updateOrganizationMembers, updateOrganizationMembersById } from "../controllers/organization.controller.mjs";

//#region src/routes/organization.routes.ts
const organizationRoute = "/api/organization";
const baseURL = () => `${process.env.BACKEND_URL}${organizationRoute}`;
const getOrganizationRoutes = () => ({
	getOrganizations: {
		urlModel: "/",
		url: baseURL(),
		method: "GET"
	},
	addOrganization: {
		urlModel: "/",
		url: baseURL(),
		method: "POST"
	},
	updateOrganization: {
		urlModel: "/",
		url: baseURL(),
		method: "PUT"
	},
	updateOrganizationMembers: {
		urlModel: "/members",
		url: `${baseURL()}/members`,
		method: "PUT"
	},
	updateOrganizationMembersById: {
		urlModel: "/:organizationId/members",
		url: ({ organizationId }) => `${baseURL()}/${organizationId}/members`,
		method: "PUT"
	},
	addOrganizationMember: {
		urlModel: "/member",
		url: `${baseURL()}/member`,
		method: "POST"
	},
	deleteOrganization: {
		urlModel: "/",
		url: baseURL(),
		method: "DELETE"
	},
	selectOrganization: {
		urlModel: "/:organizationId",
		url: ({ organizationId }) => `${baseURL()}/${organizationId}`,
		method: "PUT"
	},
	unselectOrganization: {
		urlModel: "/logout",
		url: `${baseURL()}/logout`,
		method: "POST"
	}
});
const organizationRouter = async (fastify) => {
	fastify.get(getOrganizationRoutes().getOrganizations.urlModel, getOrganizations);
	fastify.post(getOrganizationRoutes().addOrganization.urlModel, addOrganization);
	fastify.put(getOrganizationRoutes().updateOrganization.urlModel, updateOrganization);
	fastify.put(getOrganizationRoutes().updateOrganizationMembers.urlModel, updateOrganizationMembers);
	fastify.put(getOrganizationRoutes().updateOrganizationMembersById.urlModel, updateOrganizationMembersById);
	fastify.post(getOrganizationRoutes().addOrganizationMember.urlModel, addOrganizationMember);
	fastify.delete(getOrganizationRoutes().deleteOrganization.urlModel, deleteOrganization);
	fastify.put(getOrganizationRoutes().selectOrganization.urlModel, selectOrganization);
	fastify.post(getOrganizationRoutes().unselectOrganization.urlModel, unselectOrganization);
};

//#endregion
export { getOrganizationRoutes, organizationRoute, organizationRouter };
//# sourceMappingURL=organization.routes.mjs.map