package router

import (
	"netidhub-saas-be/app/module/activity_logs"
	"netidhub-saas-be/app/module/advertisement"
	"netidhub-saas-be/app/module/approval_workflow_steps"
	"netidhub-saas-be/app/module/approval_workflows"
	"netidhub-saas-be/app/module/article_approval_flows"
	"netidhub-saas-be/app/module/article_approval_step_logs"
	"netidhub-saas-be/app/module/article_approvals"
	"netidhub-saas-be/app/module/article_categories"
	"netidhub-saas-be/app/module/article_category_details"
	"netidhub-saas-be/app/module/article_comments"
	"netidhub-saas-be/app/module/article_files"
	"netidhub-saas-be/app/module/article_nulis_ai"
	"netidhub-saas-be/app/module/articles"
	"netidhub-saas-be/app/module/bookmarks"
	"netidhub-saas-be/app/module/cities"
	"netidhub-saas-be/app/module/client_approval_settings"
	"netidhub-saas-be/app/module/clients"
	"netidhub-saas-be/app/module/custom_static_pages"
	"netidhub-saas-be/app/module/districts"
	"netidhub-saas-be/app/module/feedbacks"
	"netidhub-saas-be/app/module/magazine_files"
	"netidhub-saas-be/app/module/magazines"
	"netidhub-saas-be/app/module/master_menus"
	"netidhub-saas-be/app/module/master_modules"
	"netidhub-saas-be/app/module/provinces"
	"netidhub-saas-be/app/module/schedules"
	"netidhub-saas-be/app/module/subscription"
	"netidhub-saas-be/app/module/user_levels"
	"netidhub-saas-be/app/module/user_role_accesses"
	"netidhub-saas-be/app/module/user_roles"
	"netidhub-saas-be/app/module/users"
	"netidhub-saas-be/config/config"
	_ "netidhub-saas-be/docs/swagger"

	swagger "github.com/arsmn/fiber-swagger/v2"
	"github.com/gofiber/fiber/v2"
)

type Router struct {
	App fiber.Router
	Cfg *config.Config

	ActivityLogsRouter            *activity_logs.ActivityLogsRouter
	AdvertisementRouter           *advertisement.AdvertisementRouter
	ApprovalWorkflowsRouter       *approval_workflows.ApprovalWorkflowsRouter
	ApprovalWorkflowStepsRouter   *approval_workflow_steps.ApprovalWorkflowStepsRouter
	ArticleApprovalFlowsRouter    *article_approval_flows.ArticleApprovalFlowsRouter
	ArticleApprovalStepLogsRouter *article_approval_step_logs.ArticleApprovalStepLogsRouter
	ArticleCategoriesRouter       *article_categories.ArticleCategoriesRouter
	ArticleCategoryDetailsRouter  *article_category_details.ArticleCategoryDetailsRouter
	ArticleFilesRouter            *article_files.ArticleFilesRouter
	ArticleCommentsRouter         *article_comments.ArticleCommentsRouter
	ArticleApprovalsRouter        *article_approvals.ArticleApprovalsRouter
	ArticlesRouter                *articles.ArticlesRouter
	ArticleNulisAIRouter          *article_nulis_ai.ArticleNulisAIRouter
	BookmarksRouter               *bookmarks.BookmarksRouter
	CitiesRouter                  *cities.CitiesRouter
	ClientApprovalSettingsRouter  *client_approval_settings.ClientApprovalSettingsRouter
	ClientsRouter                 *clients.ClientsRouter
	CustomStaticPagesRouter       *custom_static_pages.CustomStaticPagesRouter
	DistrictsRouter               *districts.DistrictsRouter
	FeedbacksRouter               *feedbacks.FeedbacksRouter
	MagazineFilesRouter           *magazine_files.MagazineFilesRouter
	MagazinesRouter               *magazines.MagazinesRouter
	MasterMenusRouter             *master_menus.MasterMenusRouter
	MasterModulesRouter           *master_modules.MasterModulesRouter
	ProvincesRouter               *provinces.ProvincesRouter
	SchedulesRouter               *schedules.SchedulesRouter
	SubscriptionRouter            *subscription.SubscriptionRouter
	UserLevelsRouter              *user_levels.UserLevelsRouter
	UserRoleAccessesRouter        *user_role_accesses.UserRoleAccessesRouter
	UserRolesRouter               *user_roles.UserRolesRouter
	UsersRouter                   *users.UsersRouter
}

func NewRouter(
	fiber *fiber.App,
	cfg *config.Config,

	activityLogsRouter *activity_logs.ActivityLogsRouter,
	advertisementRouter *advertisement.AdvertisementRouter,
	approvalWorkflowsRouter *approval_workflows.ApprovalWorkflowsRouter,
	approvalWorkflowStepsRouter *approval_workflow_steps.ApprovalWorkflowStepsRouter,
	articleApprovalFlowsRouter *article_approval_flows.ArticleApprovalFlowsRouter,
	articleApprovalStepLogsRouter *article_approval_step_logs.ArticleApprovalStepLogsRouter,
	articleCategoriesRouter *article_categories.ArticleCategoriesRouter,
	articleCategoryDetailsRouter *article_category_details.ArticleCategoryDetailsRouter,
	articleFilesRouter *article_files.ArticleFilesRouter,
	articleCommentsRouter *article_comments.ArticleCommentsRouter,
	articleApprovalsRouter *article_approvals.ArticleApprovalsRouter,
	articlesRouter *articles.ArticlesRouter,
	articleNulisRouter *article_nulis_ai.ArticleNulisAIRouter,
	bookmarksRouter *bookmarks.BookmarksRouter,
	citiesRouter *cities.CitiesRouter,
	clientApprovalSettingsRouter *client_approval_settings.ClientApprovalSettingsRouter,
	clientsRouter *clients.ClientsRouter,
	customStaticPagesRouter *custom_static_pages.CustomStaticPagesRouter,
	districtsRouter *districts.DistrictsRouter,
	feedbacksRouter *feedbacks.FeedbacksRouter,
	magazineFilesRouter *magazine_files.MagazineFilesRouter,
	magazinesRouter *magazines.MagazinesRouter,
	masterMenuRouter *master_menus.MasterMenusRouter,
	masterModuleRouter *master_modules.MasterModulesRouter,
	provincesRouter *provinces.ProvincesRouter,
	schedulesRouter *schedules.SchedulesRouter,
	subscriptionRouter *subscription.SubscriptionRouter,
	userLevelsRouter *user_levels.UserLevelsRouter,
	userRoleAccessesRouter *user_role_accesses.UserRoleAccessesRouter,
	userRolesRouter *user_roles.UserRolesRouter,
	usersRouter *users.UsersRouter,
) *Router {
	return &Router{
		App:                           fiber,
		Cfg:                           cfg,
		ActivityLogsRouter:            activityLogsRouter,
		AdvertisementRouter:           advertisementRouter,
		ApprovalWorkflowsRouter:       approvalWorkflowsRouter,
		ApprovalWorkflowStepsRouter:   approvalWorkflowStepsRouter,
		ArticleApprovalFlowsRouter:    articleApprovalFlowsRouter,
		ArticleApprovalStepLogsRouter: articleApprovalStepLogsRouter,
		ArticleCategoriesRouter:       articleCategoriesRouter,
		ArticleCategoryDetailsRouter:  articleCategoryDetailsRouter,
		ArticleFilesRouter:            articleFilesRouter,
		ArticleCommentsRouter:         articleCommentsRouter,
		ArticleApprovalsRouter:        articleApprovalsRouter,
		ArticlesRouter:                articlesRouter,
		ArticleNulisAIRouter:          articleNulisRouter,
		BookmarksRouter:               bookmarksRouter,
		CitiesRouter:                  citiesRouter,
		ClientApprovalSettingsRouter:  clientApprovalSettingsRouter,
		ClientsRouter:                 clientsRouter,
		CustomStaticPagesRouter:       customStaticPagesRouter,
		DistrictsRouter:               districtsRouter,
		FeedbacksRouter:               feedbacksRouter,
		MagazineFilesRouter:           magazineFilesRouter,
		MagazinesRouter:               magazinesRouter,
		MasterMenusRouter:             masterMenuRouter,
		MasterModulesRouter:           masterModuleRouter,
		ProvincesRouter:               provincesRouter,
		SchedulesRouter:               schedulesRouter,
		SubscriptionRouter:            subscriptionRouter,
		UserLevelsRouter:              userLevelsRouter,
		UserRoleAccessesRouter:        userRoleAccessesRouter,
		UserRolesRouter:               userRolesRouter,
		UsersRouter:                   usersRouter,
	}
}

// Register routes
func (r *Router) Register() {
	// Test Routes
	r.App.Get("/ping", func(c *fiber.Ctx) error {
		return c.SendString("Pong! 👋")
	})

	//Swagger Documentation
	r.App.Get("/swagger/*", swagger.HandlerDefault)

	// Register routes of modules
	r.ActivityLogsRouter.RegisterActivityLogsRoutes()
	r.AdvertisementRouter.RegisterAdvertisementRoutes()
	r.ApprovalWorkflowsRouter.RegisterApprovalWorkflowsRoutes()
	r.ApprovalWorkflowStepsRouter.RegisterApprovalWorkflowStepsRoutes()
	r.ArticleApprovalFlowsRouter.RegisterArticleApprovalFlowsRoutes()
	r.ArticleApprovalStepLogsRouter.RegisterArticleApprovalStepLogsRoutes()
	r.ArticleCategoriesRouter.RegisterArticleCategoriesRoutes()
	r.ArticleCategoryDetailsRouter.RegisterArticleCategoryDetailsRoutes()
	r.ArticleFilesRouter.RegisterArticleFilesRoutes()
	r.ArticleApprovalsRouter.RegisterArticleApprovalsRoutes()
	r.ArticlesRouter.RegisterArticlesRoutes()
	r.ArticleCommentsRouter.RegisterArticleCommentsRoutes()
	r.ArticleNulisAIRouter.RegisterArticleNulisAIRoutes()
	r.BookmarksRouter.RegisterBookmarksRoutes()
	r.CitiesRouter.RegisterCitiesRoutes()
	r.ClientApprovalSettingsRouter.RegisterClientApprovalSettingsRoutes()
	r.ClientsRouter.RegisterClientsRoutes()
	r.CustomStaticPagesRouter.RegisterCustomStaticPagesRoutes()
	r.DistrictsRouter.RegisterDistrictsRoutes()
	r.FeedbacksRouter.RegisterFeedbacksRoutes()
	r.MagazinesRouter.RegisterMagazinesRoutes()
	r.MagazineFilesRouter.RegisterMagazineFilesRoutes()
	r.MasterMenusRouter.RegisterMasterMenusRoutes()
	r.MasterModulesRouter.RegisterMasterModulesRoutes()
	r.ProvincesRouter.RegisterProvincesRoutes()
	r.SchedulesRouter.RegisterSchedulesRoutes()
	r.SubscriptionRouter.RegisterSubscriptionRoutes()
	r.UserLevelsRouter.RegisterUserLevelsRoutes()
	r.UserRoleAccessesRouter.RegisterUserRoleAccessesRoutes()
	r.UsersRouter.RegisterUsersRoutes()
	r.UserRolesRouter.RegisterUserRolesRoutes()
}
