package routes

import (
	"GoMembership/internal/controllers"
	"GoMembership/internal/middlewares"

	"github.com/gin-gonic/gin"
)

func RegisterRoutes(router *gin.Engine, userController *controllers.UserController, membershipcontroller *controllers.MembershipController, contactController *controllers.ContactController) {
	router.GET("/users/verify", userController.VerifyMailHandler)
	router.POST("/users/register", userController.RegisterUser)
	router.POST("/users/contact", contactController.RelayContactRequest)

	router.POST("/users/login", userController.LoginHandler)
	router.POST("/csp-report", middlewares.CSPReportHandling)

	apiRouter := router.Group("/api")
	apiRouter.Use(middlewares.APIKeyMiddleware())
	{
		router.POST("/v1/subscription", membershipcontroller.RegisterSubscription)
	}

	authRouter := router.Group("/backend/users")
	authRouter.Use(middlewares.AuthMiddleware())
	{
		authRouter.GET("/current", userController.CurrentUserHandler)
		authRouter.POST("/logout", userController.LogoutHandler)
		authRouter.PATCH("/update", userController.UpdateHandler)

	}
}
