// Code generated by atomctl. DO NOT EDIT.

// Package tenantjoin provides HTTP route definitions and registration
// for the quyun/v2 application.
package tenantjoin

import (
	"quyun/v2/app/http/tenantjoin/dto"
	"quyun/v2/app/middlewares"
	"quyun/v2/database/models"
	"quyun/v2/providers/jwt"

	"github.com/gofiber/fiber/v3"
	log "github.com/sirupsen/logrus"
	_ "go.ipao.vip/atom"
	_ "go.ipao.vip/atom/contracts"
	. "go.ipao.vip/atom/fen"
)

// Routes implements the HttpRoute contract and provides route registration
// for all controllers in the tenantjoin module.
//
// @provider contracts.HttpRoute atom.GroupRoutes
type Routes struct {
	log         *log.Entry `inject:"false"`
	middlewares *middlewares.Middlewares
	// Controller instances
	join *join
}

// Prepare initializes the routes provider with logging configuration.
func (r *Routes) Prepare() error {
	r.log = log.WithField("module", "routes.tenantjoin")
	r.log.Info("Initializing routes module")
	return nil
}

// Name returns the unique identifier for this routes provider.
func (r *Routes) Name() string {
	return "tenantjoin"
}

// Register registers all HTTP routes with the provided fiber router.
// Each route is registered with its corresponding controller action and parameter bindings.
func (r *Routes) Register(router fiber.Router) {
	// Register routes for controller: join
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/join/invite -> join.joinByInvite")
	router.Post("/t/:tenantCode/v1/join/invite"[len(r.Path()):], DataFunc3(
		r.join.joinByInvite,
		Local[*models.Tenant]("tenant"),
		Local[*jwt.Claims]("claims"),
		Body[dto.JoinByInviteForm]("form"),
	))
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/join/request -> join.createJoinRequest")
	router.Post("/t/:tenantCode/v1/join/request"[len(r.Path()):], DataFunc3(
		r.join.createJoinRequest,
		Local[*models.Tenant]("tenant"),
		Local[*jwt.Claims]("claims"),
		Body[dto.JoinRequestCreateForm]("form"),
	))

	r.log.Info("Successfully registered all routes")
}
