package router

import (
	platformmodule "kra/pkg/module"

	"github.com/gin-gonic/gin"
)

type Routes struct {
	handlers *Set
}

func NewRoutes(handlers *Set) *Routes { return &Routes{handlers: handlers} }

var _ platformmodule.RouteRegistrar = (*Routes)(nil)

func (r *Routes) RegisterRoutes(public, private *gin.RouterGroup, engine *gin.Engine) {
	if r == nil || r.handlers == nil {
		return
	}
	RegisterPublic(public, engine, r.handlers.Public)
	RegisterUser(private, r.handlers.User)
	RegisterNavigation(private, r.handlers.Navigation)
	RegisterSession(private, r.handlers.Session)
	RegisterAuthority(private, r.handlers.Authority)
	RegisterMenu(private, r.handlers.Menu)
	RegisterAPI(private, public, engine, r.handlers.API)
	RegisterPermission(private, r.handlers.Permission)
	RegisterOrganization(private, r.handlers.Organization)
	RegisterDictionary(private, r.handlers.Dictionary)
	RegisterParameter(private, r.handlers.Parameter)
	RegisterAPIToken(private, r.handlers.APIToken)
	RegisterSystemConfig(private, r.handlers.SystemConfig)
	RegisterVersion(private, r.handlers.Version)
	RegisterExport(private, public, r.handlers.Export)
	RegisterAudit(private, public, r.handlers.Audit)
	RegisterTask(private, r.handlers.Task)
	RegisterMedia(private, r.handlers.Media)
	RegisterAnnouncement(private, public, r.handlers.Announcement)
	RegisterEmail(private, r.handlers.Email)
	RegisterIntegrationConfig(private, r.handlers.IntegrationConfig)
	RegisterPayment(private, public, r.handlers.Payment)
}
