package api

import (
	"github.com/gofiber/fiber/v2"

	"github.com/sentinela-go/internal/api/handlers"
	"github.com/sentinela-go/internal/db"
)

func RegisterRoutes(app *fiber.App, database *db.DB) {
	h := handlers.New(database)

	app.Get("/health", h.Health)

	v1 := app.Group("/api/v1")

	v1.Get("/companies", h.ListCompanies)
	v1.Get("/companies/search", h.SearchCompanies)
	v1.Get("/companies/:id", h.GetCompany)
	v1.Get("/companies/:id/filings", h.CompanyFilings)

	v1.Get("/filings", h.ListFilings)
	v1.Get("/filings/search", h.SearchFilings)
	v1.Get("/filings/recent", h.RecentFilings)
	v1.Get("/filings/:id", h.GetFiling)

	v1.Get("/market/selic", h.ListSelic)
	v1.Get("/market/selic/current", h.CurrentSelic)
	v1.Get("/market/cdi", h.ListCDI)
	v1.Get("/market/cdi/current", h.CurrentCDI)
	v1.Get("/market/ipca", h.ListIPCA)
	v1.Get("/market/ipca/current", h.CurrentIPCA)
	v1.Get("/market/fx", h.ListFX)
	v1.Get("/market/fx/current", h.CurrentFX)
	v1.Get("/market/overview", h.MarketOverview)

	v1.Get("/search", h.GlobalSearch)
}
