package visitroute

import (
	"bitbucket.org/nemt/nemt-portal-api/application/applicationservice"
	"bitbucket.org/nemt/nemt-portal-api/application/tncservice"
	"bitbucket.org/nemt/nemt-portal-api/infra/config"
	"github.com/labstack/echo"
)

const (
	rootRoute = "/"
	idRoute   = "/:visit_uuid"
	rideRoute = "/:visit_uuid/ride"
)

// Register registers the routes in the echo group
func Register(r *echo.Group, cfg *config.Config, svc *applicationservice.Service, tnc *tncservice.Service) {
	ctrl := controllerInstance(svc, cfg, tnc)

	r.POST(rootRoute, ctrl.handle)
	r.POST(rideRoute, ctrl.handleRide)

	r.GET(rootRoute, ctrl.handleGetAll)
	r.GET(idRoute, ctrl.handleGetByID)
}
