package httpapi

import (
	"log"
	"net/http"

	"github.com/allai/allai-backend/internal/app"
)

// NewRouter wires HTTP endpoints to the application service.
func NewRouter(service *app.Service, logger *log.Logger) http.Handler {
	handler := &Handler{
		service: service,
		logger:  logger,
	}

	mux := http.NewServeMux()
	mux.HandleFunc("GET /healthz", handler.health)
	mux.HandleFunc("GET /api/v1/models", handler.listModels)
	mux.HandleFunc("POST /api/v1/generate", handler.generate)

	return middleware(mux, logger)
}
