package router

import (
	"campaign-pool-be/app/module/activity_logs"
	"campaign-pool-be/app/module/advertisement"
	"campaign-pool-be/app/module/ai_chat"
	"campaign-pool-be/app/module/article_approvals"
	"campaign-pool-be/app/module/article_categories"
	"campaign-pool-be/app/module/article_category_details"
	"campaign-pool-be/app/module/article_comments"
	"campaign-pool-be/app/module/article_files"
	"campaign-pool-be/app/module/articles"
	"campaign-pool-be/app/module/campaign_destinations"
	"campaign-pool-be/app/module/campaign_types"
	"campaign-pool-be/app/module/campaigns"
	"campaign-pool-be/app/module/campaign_files"
	"campaign-pool-be/app/module/chat"
	"campaign-pool-be/app/module/cities"
	"campaign-pool-be/app/module/custom_static_pages"
	"campaign-pool-be/app/module/districts"
	"campaign-pool-be/app/module/ebooks"
	"campaign-pool-be/app/module/education_history"
	"campaign-pool-be/app/module/feedbacks"
	"campaign-pool-be/app/module/magazine_files"
	"campaign-pool-be/app/module/magazines"
	"campaign-pool-be/app/module/master_menus"
	"campaign-pool-be/app/module/master_modules"
	"campaign-pool-be/app/module/provinces"
	"campaign-pool-be/app/module/research_journals"
	"campaign-pool-be/app/module/subscription"
	"campaign-pool-be/app/module/user_levels"
	"campaign-pool-be/app/module/user_role_accesses"
	"campaign-pool-be/app/module/user_roles"
	"campaign-pool-be/app/module/users"
	"campaign-pool-be/app/module/work_history"
	"campaign-pool-be/config/config"
	_ "campaign-pool-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
	AIChatRouter                 *ai_chat.AIChatRouter
	ArticleCategoriesRouter      *article_categories.ArticleCategoriesRouter
	ArticleCategoryDetailsRouter *article_category_details.ArticleCategoryDetailsRouter
	ArticleFilesRouter           *article_files.ArticleFilesRouter
	ArticleCommentsRouter        *article_comments.ArticleCommentsRouter
	ArticleApprovalsRouter       *article_approvals.ArticleApprovalsRouter
	ArticlesRouter               *articles.ArticlesRouter
	ChatRouter                   *chat.ChatRouter
	CitiesRouter                 *cities.CitiesRouter
	CustomStaticPagesRouter      *custom_static_pages.CustomStaticPagesRouter
	DistrictsRouter              *districts.DistrictsRouter
	EbooksRouter                 *ebooks.EbooksRouter
	FeedbacksRouter              *feedbacks.FeedbacksRouter
	MagazineFilesRouter          *magazine_files.MagazineFilesRouter
	MagazinesRouter              *magazines.MagazinesRouter
	MasterMenusRouter            *master_menus.MasterMenusRouter
	MasterModulesRouter          *master_modules.MasterModulesRouter
	ProvincesRouter              *provinces.ProvincesRouter
	SubscriptionRouter           *subscription.SubscriptionRouter
	UserLevelsRouter             *user_levels.UserLevelsRouter
	UserRoleAccessesRouter       *user_role_accesses.UserRoleAccessesRouter
	UserRolesRouter              *user_roles.UserRolesRouter
	UsersRouter                  *users.UsersRouter
	EducationHistoryRouter       *education_history.EducationHistoryRouter
	WorkHistoryRouter            *work_history.WorkHistoryRouter
	ResearchJournalsRouter       *research_journals.ResearchJournalsRouter
	CampaignTypesRouter          *campaign_types.CampaignTypesRouter
	CampaignDestinationsRouter   *campaign_destinations.CampaignDestinationsRouter
	CampaignsRouter              *campaigns.CampaignsRouter
	CampaignFilesRouter          *campaign_files.CampaignFilesRouter
}

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

	activityLogsRouter *activity_logs.ActivityLogsRouter,
	advertisementRouter *advertisement.AdvertisementRouter,
	aiChatRouter *ai_chat.AIChatRouter,
	articleCategoriesRouter *article_categories.ArticleCategoriesRouter,
	articleCategoryDetailsRouter *article_category_details.ArticleCategoryDetailsRouter,
	articleFilesRouter *article_files.ArticleFilesRouter,
	articleCommentsRouter *article_comments.ArticleCommentsRouter,
	articleApprovalsRouter *article_approvals.ArticleApprovalsRouter,
	articlesRouter *articles.ArticlesRouter,
	chatRouter *chat.ChatRouter,
	citiesRouter *cities.CitiesRouter,
	customStaticPagesRouter *custom_static_pages.CustomStaticPagesRouter,
	districtsRouter *districts.DistrictsRouter,
	ebooksRouter *ebooks.EbooksRouter,
	feedbacksRouter *feedbacks.FeedbacksRouter,
	magazineFilesRouter *magazine_files.MagazineFilesRouter,
	magazinesRouter *magazines.MagazinesRouter,
	masterMenuRouter *master_menus.MasterMenusRouter,
	masterModuleRouter *master_modules.MasterModulesRouter,
	provincesRouter *provinces.ProvincesRouter,
	subscriptionRouter *subscription.SubscriptionRouter,
	userLevelsRouter *user_levels.UserLevelsRouter,
	userRoleAccessesRouter *user_role_accesses.UserRoleAccessesRouter,
	userRolesRouter *user_roles.UserRolesRouter,
	usersRouter *users.UsersRouter,
	educationHistoryRouter *education_history.EducationHistoryRouter,
	workHistoryRouter *work_history.WorkHistoryRouter,
	researchJournalsRouter *research_journals.ResearchJournalsRouter,
	campaignTypesRouter *campaign_types.CampaignTypesRouter,
	campaignDestinationsRouter *campaign_destinations.CampaignDestinationsRouter,
	campaignsRouter *campaigns.CampaignsRouter,
	campaignFilesRouter *campaign_files.CampaignFilesRouter,
) *Router {
	return &Router{
		App:                          fiber,
		Cfg:                          cfg,
		ActivityLogsRouter:           activityLogsRouter,
		AdvertisementRouter:          advertisementRouter,
		AIChatRouter:                 aiChatRouter,
		ArticleCategoriesRouter:      articleCategoriesRouter,
		ArticleCategoryDetailsRouter: articleCategoryDetailsRouter,
		ArticleFilesRouter:           articleFilesRouter,
		ArticleCommentsRouter:        articleCommentsRouter,
		ArticleApprovalsRouter:       articleApprovalsRouter,
		ArticlesRouter:               articlesRouter,
		ChatRouter:                   chatRouter,
		CitiesRouter:                 citiesRouter,
		CustomStaticPagesRouter:      customStaticPagesRouter,
		DistrictsRouter:              districtsRouter,
		EbooksRouter:                 ebooksRouter,
		FeedbacksRouter:              feedbacksRouter,
		MagazineFilesRouter:          magazineFilesRouter,
		MagazinesRouter:              magazinesRouter,
		MasterMenusRouter:            masterMenuRouter,
		MasterModulesRouter:          masterModuleRouter,
		ProvincesRouter:              provincesRouter,
		SubscriptionRouter:           subscriptionRouter,
		UserLevelsRouter:             userLevelsRouter,
		UserRoleAccessesRouter:       userRoleAccessesRouter,
		UserRolesRouter:              userRolesRouter,
		UsersRouter:                  usersRouter,
		EducationHistoryRouter:       educationHistoryRouter,
		WorkHistoryRouter:            workHistoryRouter,
		ResearchJournalsRouter:       researchJournalsRouter,
		CampaignTypesRouter:          campaignTypesRouter,
		CampaignDestinationsRouter:   campaignDestinationsRouter,
		CampaignsRouter:              campaignsRouter,
		CampaignFilesRouter:          campaignFilesRouter,
	}
}

// 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.AIChatRouter.RegisterAIChatRoutes()
	r.ArticleCategoriesRouter.RegisterArticleCategoriesRoutes()
	r.ArticleCategoryDetailsRouter.RegisterArticleCategoryDetailsRoutes()
	r.ArticleFilesRouter.RegisterArticleFilesRoutes()
	r.ArticleApprovalsRouter.RegisterArticleApprovalsRoutes()
	r.ArticlesRouter.RegisterArticlesRoutes()
	r.ArticleCommentsRouter.RegisterArticleCommentsRoutes()
	r.ChatRouter.RegisterChatRoutes()
	r.CitiesRouter.RegisterCitiesRoutes()
	r.CustomStaticPagesRouter.RegisterCustomStaticPagesRoutes()
	r.DistrictsRouter.RegisterDistrictsRoutes()
	r.EbooksRouter.RegisterEbooksRoutes()
	r.FeedbacksRouter.RegisterFeedbacksRoutes()
	r.MagazinesRouter.RegisterMagazinesRoutes()
	r.MagazineFilesRouter.RegisterMagazineFilesRoutes()
	r.MasterMenusRouter.RegisterMasterMenusRoutes()
	r.MasterModulesRouter.RegisterMasterModulesRoutes()
	r.ProvincesRouter.RegisterProvincesRoutes()
	r.SubscriptionRouter.RegisterSubscriptionRoutes()
	r.UserLevelsRouter.RegisterUserLevelsRoutes()
	r.UserRoleAccessesRouter.RegisterUserRoleAccessesRoutes()
	r.UsersRouter.RegisterUsersRoutes()
	r.UserRolesRouter.RegisterUserRolesRoutes()
	r.EducationHistoryRouter.RegisterEducationHistoryRoutes()
	r.WorkHistoryRouter.RegisterWorkHistoryRoutes()
	r.ResearchJournalsRouter.RegisterResearchJournalsRoutes()
	r.CampaignTypesRouter.RegisterCampaignTypesRoutes()
	r.CampaignDestinationsRouter.RegisterCampaignDestinationsRoutes()
	r.CampaignsRouter.RegisterCampaignsRoutes()
	r.CampaignFilesRouter.RegisterCampaignFilesRoutes()
}
