package server

import (
	"github.com/gofiber/fiber/v2/middleware/cors"
)

var (
	defaultCORS = cors.New(cors.Config{
		AllowOrigins: "*",
		// AllowCredentials: true,
		AllowMethods: "GET, POST, PATCH, PUT, DELETE, OPTIONS",
		AllowHeaders: "Accept, Authorization, Content-Type, Vary, X-Request-Id",
	})
)

func SetupRouter(s *Server) {
	s.Options("*", defaultCORS)
	s.Use(defaultCORS)

	s.Get("/health", s.HealthHandler)

	api := s.Group("/api")
	v1 := api.Group("/v1")
	v1.Post("/login", s.LoginHandler)
}
