// Code generated by atomctl. DO NOT EDIT.

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

import (
	"quyun/v2/app/http/tenant/dto"
	"quyun/v2/app/middlewares"
	"quyun/v2/database/models"

	"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 tenant module.
//
// @provider contracts.HttpRoute atom.GroupRoutes
type Routes struct {
	log         *log.Entry `inject:"false"`
	middlewares *middlewares.Middlewares
	// Controller instances
	content           *content
	contentAdmin      *contentAdmin
	me                *me
	order             *order
	orderAdmin        *orderAdmin
	orderMe           *orderMe
	tenantInviteAdmin *tenantInviteAdmin
	tenantJoinAdmin   *tenantJoinAdmin
	tenantUserAdmin   *tenantUserAdmin
}

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

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

// 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: content
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/contents -> content.list")
	router.Get("/t/:tenantCode/v1/contents"[len(r.Path()):], DataFunc3(
		r.content.list,
		Local[*models.Tenant]("tenant"),
		Local[*models.User]("user"),
		Query[dto.ContentListFilter]("filter"),
	))
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/contents/:contentID -> content.show")
	router.Get("/t/:tenantCode/v1/contents/:contentID"[len(r.Path()):], DataFunc3(
		r.content.show,
		Local[*models.Tenant]("tenant"),
		Local[*models.User]("user"),
		PathParam[int64]("contentID"),
	))
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/contents/:contentID/assets -> content.mainAssets")
	router.Get("/t/:tenantCode/v1/contents/:contentID/assets"[len(r.Path()):], DataFunc3(
		r.content.mainAssets,
		Local[*models.Tenant]("tenant"),
		Local[*models.User]("user"),
		PathParam[int64]("contentID"),
	))
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/contents/:contentID/preview -> content.previewAssets")
	router.Get("/t/:tenantCode/v1/contents/:contentID/preview"[len(r.Path()):], DataFunc3(
		r.content.previewAssets,
		Local[*models.Tenant]("tenant"),
		Local[*models.User]("user"),
		PathParam[int64]("contentID"),
	))
	// Register routes for controller: contentAdmin
	r.log.Debugf("Registering route: Patch /t/:tenantCode/v1/admin/contents/:contentID -> contentAdmin.update")
	router.Patch("/t/:tenantCode/v1/admin/contents/:contentID"[len(r.Path()):], DataFunc4(
		r.contentAdmin.update,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("contentID"),
		Body[dto.ContentUpdateForm]("form"),
	))
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/admin/contents -> contentAdmin.create")
	router.Post("/t/:tenantCode/v1/admin/contents"[len(r.Path()):], DataFunc3(
		r.contentAdmin.create,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		Body[dto.ContentCreateForm]("form"),
	))
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/admin/contents/:contentID/assets -> contentAdmin.attachAsset")
	router.Post("/t/:tenantCode/v1/admin/contents/:contentID/assets"[len(r.Path()):], DataFunc4(
		r.contentAdmin.attachAsset,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("contentID"),
		Body[dto.ContentAssetAttachForm]("form"),
	))
	r.log.Debugf("Registering route: Put /t/:tenantCode/v1/admin/contents/:contentID/price -> contentAdmin.upsertPrice")
	router.Put("/t/:tenantCode/v1/admin/contents/:contentID/price"[len(r.Path()):], DataFunc4(
		r.contentAdmin.upsertPrice,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("contentID"),
		Body[dto.ContentPriceUpsertForm]("form"),
	))
	// Register routes for controller: me
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me -> me.get")
	router.Get("/t/:tenantCode/v1/me"[len(r.Path()):], DataFunc3(
		r.me.get,
		Local[*models.Tenant]("tenant"),
		Local[*models.User]("user"),
		Local[*models.TenantUser]("tenant_user"),
	))
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/balance -> me.balance")
	router.Get("/t/:tenantCode/v1/me/balance"[len(r.Path()):], DataFunc2(
		r.me.balance,
		Local[*models.Tenant]("tenant"),
		Local[*models.User]("user"),
	))
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/ledgers -> me.ledgers")
	router.Get("/t/:tenantCode/v1/me/ledgers"[len(r.Path()):], DataFunc3(
		r.me.ledgers,
		Local[*models.Tenant]("tenant"),
		Local[*models.User]("user"),
		Query[dto.MyLedgerListFilter]("filter"),
	))
	// Register routes for controller: order
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/contents/:contentID/purchase -> order.purchaseContent")
	router.Post("/t/:tenantCode/v1/contents/:contentID/purchase"[len(r.Path()):], DataFunc4(
		r.order.purchaseContent,
		Local[*models.Tenant]("tenant"),
		Local[*models.User]("user"),
		PathParam[int64]("contentID"),
		Body[dto.PurchaseContentForm]("form"),
	))
	// Register routes for controller: orderAdmin
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/admin/orders -> orderAdmin.adminOrderList")
	router.Get("/t/:tenantCode/v1/admin/orders"[len(r.Path()):], DataFunc3(
		r.orderAdmin.adminOrderList,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		Query[dto.AdminOrderListFilter]("filter"),
	))
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/admin/orders/:orderID -> orderAdmin.adminOrderDetail")
	router.Get("/t/:tenantCode/v1/admin/orders/:orderID"[len(r.Path()):], DataFunc3(
		r.orderAdmin.adminOrderDetail,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("orderID"),
	))
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/admin/orders/:orderID/refund -> orderAdmin.adminRefund")
	router.Post("/t/:tenantCode/v1/admin/orders/:orderID/refund"[len(r.Path()):], DataFunc4(
		r.orderAdmin.adminRefund,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("orderID"),
		Body[dto.AdminOrderRefundForm]("form"),
	))
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/admin/users/:userID/topup -> orderAdmin.adminTopupUser")
	router.Post("/t/:tenantCode/v1/admin/users/:userID/topup"[len(r.Path()):], DataFunc4(
		r.orderAdmin.adminTopupUser,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("userID"),
		Body[dto.AdminTopupForm]("form"),
	))
	// Register routes for controller: orderMe
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/orders -> orderMe.myOrders")
	router.Get("/t/:tenantCode/v1/orders"[len(r.Path()):], DataFunc3(
		r.orderMe.myOrders,
		Local[*models.Tenant]("tenant"),
		Local[*models.User]("user"),
		Query[dto.MyOrderListFilter]("filter"),
	))
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/orders/:orderID -> orderMe.myOrderDetail")
	router.Get("/t/:tenantCode/v1/orders/:orderID"[len(r.Path()):], DataFunc3(
		r.orderMe.myOrderDetail,
		Local[*models.Tenant]("tenant"),
		Local[*models.User]("user"),
		PathParam[int64]("orderID"),
	))
	// Register routes for controller: tenantInviteAdmin
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/admin/invites -> tenantInviteAdmin.adminInviteList")
	router.Get("/t/:tenantCode/v1/admin/invites"[len(r.Path()):], DataFunc3(
		r.tenantInviteAdmin.adminInviteList,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		Query[dto.AdminTenantInviteListFilter]("filter"),
	))
	r.log.Debugf("Registering route: Patch /t/:tenantCode/v1/admin/invites/:inviteID/disable -> tenantInviteAdmin.adminDisableInvite")
	router.Patch("/t/:tenantCode/v1/admin/invites/:inviteID/disable"[len(r.Path()):], DataFunc4(
		r.tenantInviteAdmin.adminDisableInvite,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("inviteID"),
		Body[dto.AdminTenantInviteDisableForm]("form"),
	))
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/admin/invites -> tenantInviteAdmin.adminCreateInvite")
	router.Post("/t/:tenantCode/v1/admin/invites"[len(r.Path()):], DataFunc3(
		r.tenantInviteAdmin.adminCreateInvite,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		Body[dto.AdminTenantInviteCreateForm]("form"),
	))
	// Register routes for controller: tenantJoinAdmin
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/admin/join-requests -> tenantJoinAdmin.adminJoinRequests")
	router.Get("/t/:tenantCode/v1/admin/join-requests"[len(r.Path()):], DataFunc3(
		r.tenantJoinAdmin.adminJoinRequests,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		Query[dto.AdminTenantJoinRequestListFilter]("filter"),
	))
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/admin/join-requests/:requestID/approve -> tenantJoinAdmin.adminApproveJoinRequest")
	router.Post("/t/:tenantCode/v1/admin/join-requests/:requestID/approve"[len(r.Path()):], DataFunc4(
		r.tenantJoinAdmin.adminApproveJoinRequest,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("requestID"),
		Body[dto.AdminTenantJoinRequestDecideForm]("form"),
	))
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/admin/join-requests/:requestID/reject -> tenantJoinAdmin.adminRejectJoinRequest")
	router.Post("/t/:tenantCode/v1/admin/join-requests/:requestID/reject"[len(r.Path()):], DataFunc4(
		r.tenantJoinAdmin.adminRejectJoinRequest,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("requestID"),
		Body[dto.AdminTenantJoinRequestDecideForm]("form"),
	))
	// Register routes for controller: tenantUserAdmin
	r.log.Debugf("Registering route: Delete /t/:tenantCode/v1/admin/users/:userID -> tenantUserAdmin.adminRemoveUser")
	router.Delete("/t/:tenantCode/v1/admin/users/:userID"[len(r.Path()):], Func3(
		r.tenantUserAdmin.adminRemoveUser,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("userID"),
	))
	r.log.Debugf("Registering route: Get /t/:tenantCode/v1/admin/users -> tenantUserAdmin.adminTenantUsers")
	router.Get("/t/:tenantCode/v1/admin/users"[len(r.Path()):], DataFunc3(
		r.tenantUserAdmin.adminTenantUsers,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		Query[dto.AdminTenantUserListFilter]("filter"),
	))
	r.log.Debugf("Registering route: Patch /t/:tenantCode/v1/admin/users/:userID/role -> tenantUserAdmin.adminSetUserRole")
	router.Patch("/t/:tenantCode/v1/admin/users/:userID/role"[len(r.Path()):], DataFunc4(
		r.tenantUserAdmin.adminSetUserRole,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("userID"),
		Body[dto.AdminTenantUserRoleUpdateForm]("form"),
	))
	r.log.Debugf("Registering route: Post /t/:tenantCode/v1/admin/users/:userID/join -> tenantUserAdmin.adminJoinUser")
	router.Post("/t/:tenantCode/v1/admin/users/:userID/join"[len(r.Path()):], DataFunc3(
		r.tenantUserAdmin.adminJoinUser,
		Local[*models.Tenant]("tenant"),
		Local[*models.TenantUser]("tenant_user"),
		PathParam[int64]("userID"),
	))

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