package main

import (
	"git.kanopo.dev/rhythm/rhythm-backend/internal/config"
	"git.kanopo.dev/rhythm/rhythm-backend/internal/db"
	"git.kanopo.dev/rhythm/rhythm-backend/internal/http"
	"git.kanopo.dev/rhythm/rhythm-backend/internal/http/api/health"
	"git.kanopo.dev/rhythm/rhythm-backend/internal/logger"
	"go.uber.org/fx"
	"go.uber.org/fx/fxevent"
	"go.uber.org/zap"
)

func main() {
	fx.New(
		fx.Provide(
			config.Provide,
			logger.ProvideLogger,
			db.ProvidePool,
			http.NewServer,
			health.NewHandler,
		),
		fx.Invoke(
			http.GlueRoutes,
		),
		fx.WithLogger(func(logger *zap.Logger) fxevent.Logger {
			return &fxevent.ZapLogger{Logger: logger}
		}),
	).Run()
}
