package hamview

import (
	"github.com/sirupsen/logrus"

	"git.maze.io/ham/hamview/server"
)

// Deprecated: Use server.Config instead
type ServerConfig = server.Config

// Deprecated: Use server.Server instead
type Server = server.Server

// NewServer creates a new server instance
// Deprecated: Use server.New instead
func NewServer(serverConfig *ServerConfig, databaseConfig *DatabaseConfig) (*Server, error) {
	// Get logger from the global context or create a new one
	logger := Logger
	if logger == nil {
		logger = logrus.New()
	}

	dbConfig := &server.DatabaseConfig{
		Type: databaseConfig.Type,
		Conf: databaseConfig.Conf,
	}

	return server.New(serverConfig, dbConfig, logger)
}
