import { getNewsletterStatus, subscribeToNewsletter, unsubscribeFromNewsletter } from "../controllers/newsletter.controller.mjs";

//#region src/routes/newsletter.routes.ts
const newsletterRoute = "/api/newsletter";
const baseURL = () => `${process.env.BACKEND_URL}${newsletterRoute}`;
const getNewsletterRoutes = () => ({
	subscribeToNewsletter: {
		urlModel: "/subscribe",
		url: `${baseURL()}/subscribe`,
		method: "POST"
	},
	unsubscribeFromNewsletter: {
		urlModel: "/unsubscribe",
		url: `${baseURL()}/unsubscribe`,
		method: "POST"
	},
	getNewsletterStatus: {
		urlModel: "/status",
		url: `${baseURL()}/status`,
		method: "GET"
	}
});
const newsletterRouter = async (fastify) => {
	fastify.post(getNewsletterRoutes().subscribeToNewsletter.urlModel, subscribeToNewsletter);
	fastify.post(getNewsletterRoutes().unsubscribeFromNewsletter.urlModel, unsubscribeFromNewsletter);
	fastify.get(getNewsletterRoutes().getNewsletterStatus.urlModel, getNewsletterStatus);
};

//#endregion
export { getNewsletterRoutes, newsletterRoute, newsletterRouter };
//# sourceMappingURL=newsletter.routes.mjs.map