package http

import (
	"net/http"

	"go.b0esche.cloud/backend/internal/audit"
	"go.b0esche.cloud/backend/internal/auth"
	"go.b0esche.cloud/backend/internal/config"
	"go.b0esche.cloud/backend/internal/database"
	"go.b0esche.cloud/backend/pkg/jwt"
)

type Server struct {
	*http.Server
}

func New(cfg *config.Config, db *database.DB, jwtManager *jwt.Manager, authService *auth.Service, auditLogger *audit.Logger) *Server {
	r := NewRouter(cfg, db, jwtManager, authService, auditLogger)

	return &Server{
		Server: &http.Server{
			Addr:    cfg.ServerAddr,
			Handler: r,
		},
	}
}
