// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.6

package handler

import (
	"net/http"

	admin "apps/backend/internal/handler/admin"
	auth "apps/backend/internal/handler/auth"
	benchmark "apps/backend/internal/handler/benchmark"
	billing "apps/backend/internal/handler/billing"
	checkups "apps/backend/internal/handler/checkups"
	compose "apps/backend/internal/handler/compose"
	crm "apps/backend/internal/handler/crm"
	extension "apps/backend/internal/handler/extension"
	health "apps/backend/internal/handler/health"
	insightsapi "apps/backend/internal/handler/insightsapi"
	inspire "apps/backend/internal/handler/inspire"
	invite "apps/backend/internal/handler/invite"
	jobs "apps/backend/internal/handler/jobs"
	media "apps/backend/internal/handler/media"
	mentions "apps/backend/internal/handler/mentions"
	notifications "apps/backend/internal/handler/notifications"
	outbox "apps/backend/internal/handler/outbox"
	outcomes "apps/backend/internal/handler/outcomes"
	ownposts "apps/backend/internal/handler/ownposts"
	personas "apps/backend/internal/handler/personas"
	ping "apps/backend/internal/handler/ping"
	playbooks "apps/backend/internal/handler/playbooks"
	plays "apps/backend/internal/handler/plays"
	proxy "apps/backend/internal/handler/proxy"
	publictools "apps/backend/internal/handler/publictools"
	publicutm "apps/backend/internal/handler/publicutm"
	radar "apps/backend/internal/handler/radar"
	research "apps/backend/internal/handler/research"
	scout "apps/backend/internal/handler/scout"
	settings "apps/backend/internal/handler/settings"
	threads "apps/backend/internal/handler/threads"
	usage "apps/backend/internal/handler/usage"
	utm "apps/backend/internal/handler/utm"
	workspaces "apps/backend/internal/handler/workspaces"
	"apps/backend/internal/svc"

	"github.com/zeromicro/go-zero/rest"
)

func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT, serverCtx.AdminAuth},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/members",
					Handler: admin.ListMembersHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/members",
					Handler: admin.CreateMemberHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/members/:uid",
					Handler: admin.GetMemberHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/members/:uid/email-verified",
					Handler: admin.SetEmailVerifiedHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/members/:uid/identities",
					Handler: admin.ListMemberIdentitiesHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/members/:uid/reset-password",
					Handler: admin.AdminResetPasswordHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/members/:uid/roles",
					Handler: admin.SetRolesHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/members/:uid/status",
					Handler: admin.SetStatusHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/members/:uid/suspend",
					Handler: admin.SetSuspendedHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/admin"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodPost,
				Path:    "/login",
				Handler: auth.LoginHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/logout",
				Handler: auth.LogoutHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/oauth/:provider/callback",
				Handler: auth.OAuthCallbackHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/oauth/:provider/start",
				Handler: auth.OAuthStartHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/password/request-reset",
				Handler: auth.RequestPasswordResetHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/password/reset",
				Handler: auth.ResetPasswordHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/refresh",
				Handler: auth.RefreshHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/register",
				Handler: auth.RegisterHandler(serverCtx),
			},
		},
		rest.WithPrefix("/api/v1/auth"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/bind",
					Handler: auth.BindAccountHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/email/send-code",
					Handler: auth.SendEmailCodeHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/email/verify",
					Handler: auth.VerifyEmailHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/identities",
					Handler: auth.ListIdentitiesHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/logout-all",
					Handler: auth.LogoutAllHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/me",
					Handler: auth.MeHandler(serverCtx),
				},
				{
					Method:  http.MethodPatch,
					Path:    "/profile",
					Handler: auth.UpdateProfileHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/profile",
					Handler: auth.UpdateProfilePutHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/unbind",
					Handler: auth.UnbindAccountHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/auth"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: benchmark.GetBenchmarkHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/benchmark"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/checkout-sessions",
					Handler: billing.CreateBillingCheckoutSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/checkout-sessions/:id",
					Handler: billing.GetBillingCheckoutSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/portal-sessions",
					Handler: billing.CreateBillingPortalSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/subscription",
					Handler: billing.GetBillingSubscriptionHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/billing"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.StripeRawBody},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/stripe/webhook",
					Handler: billing.HandleStripeWebhookHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/billing"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: checkups.ListCheckupsHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/:id",
					Handler: checkups.GetCheckupHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/generate",
					Handler: checkups.GenerateCheckupNowHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/latest",
					Handler: checkups.GetLatestCheckupHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/checkups"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/analyze-viral",
					Handler: compose.ComposeAnalyzeViralHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/mimic",
					Handler: compose.ComposeMimicHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/persona-preview",
					Handler: compose.ComposePersonaPreviewHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/publish-single",
					Handler: compose.ComposePublishSingleHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/compose"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/contacts",
					Handler: crm.ListContactsHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/contacts/:id",
					Handler: crm.GetContactHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/contacts/:id",
					Handler: crm.DeleteContactHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/contacts/:id/conversion",
					Handler: crm.CreateContactConversionHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/contacts/:id/conversion",
					Handler: crm.UpdateContactConversionHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/contacts/:id/conversion",
					Handler: crm.DeleteContactConversionHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/contacts/:id/follow-up",
					Handler: crm.SetContactFollowUpHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/contacts/:id/merge",
					Handler: crm.MergeContactHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/contacts/:id/notes",
					Handler: crm.CreateContactNoteHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/contacts/:id/stage",
					Handler: crm.UpdateContactStageHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/contacts/:id/unmerge",
					Handler: crm.UnmergeContactHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/followups",
					Handler: crm.ListFollowUpsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/followups/:id/done",
					Handler: crm.DoneFollowUpHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/followups/:id/message",
					Handler: crm.GenerateFollowUpMessageHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/followups/:id/snooze",
					Handler: crm.SnoozeFollowUpHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/stats",
					Handler: crm.GetCrmStatsHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/crm"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/download",
					Handler: extension.DownloadExtensionZipHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/extension"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: health.ListAccountHealthHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/:accountId",
					Handler: health.GetAccountHealthHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/account-health"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/summary",
					Handler: insightsapi.GetInsightsSummaryHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/insights"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/chat",
					Handler: inspire.InspireChatHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/elements",
					Handler: inspire.ListInspireElementsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/elements",
					Handler: inspire.SaveInspireElementHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/elements/:id",
					Handler: inspire.RemoveInspireElementHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/prompt-preview",
					Handler: inspire.InspirePromptPreviewHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/session",
					Handler: inspire.GetInspireSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/session/clear",
					Handler: inspire.ClearInspireSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/sessions",
					Handler: inspire.ListInspireSessionsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/sessions",
					Handler: inspire.CreateInspireSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/sessions/:id",
					Handler: inspire.GetInspireSessionByIdHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/sessions/:id",
					Handler: inspire.DeleteInspireSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/sessions/:id/activate",
					Handler: inspire.ActivateInspireSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/trends",
					Handler: inspire.ListTrendsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/trends/refresh",
					Handler: inspire.RefreshTrendsHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/inspire"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/apply",
					Handler: invite.ApplyInviteCodeHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/me",
					Handler: invite.GetMyInviteNetworkHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/invite"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT, serverCtx.AdminAuth},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/move",
					Handler: invite.MoveInviteMemberHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/parent-candidates",
					Handler: invite.ListInviteParentCandidatesHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/tree",
					Handler: invite.GetInviteTreeHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/invite"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: jobs.ListJobsHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/:id",
					Handler: jobs.GetJobHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/:id",
					Handler: jobs.DeleteJobHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/jobs"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT, serverCtx.AdminAuth},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/demo",
					Handler: jobs.StartDemoJobHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/jobs"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/upload",
					Handler: media.UploadHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/media"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/generate-image",
					Handler: media.GenerateImageHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/media"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: mentions.ListMentionsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/generate-reply",
					Handler: mentions.MentionGenerateReplyHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/mark-replied",
					Handler: mentions.MentionMarkRepliedHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/skip",
					Handler: mentions.MentionSkipHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/sync",
					Handler: mentions.SyncMentionsHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/mentions"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: notifications.ListNotificationsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/read",
					Handler: notifications.MarkNotificationReadHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/read-all",
					Handler: notifications.MarkAllNotificationsReadHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/unread-count",
					Handler: notifications.UnreadNotificationCountHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/notifications"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: outbox.ListOutboxHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/:id",
					Handler: outbox.GetOutboxHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/:id",
					Handler: outbox.RemoveOutboxHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/steps/:stepId/retry",
					Handler: outbox.RetryOutboxStepHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/outbox"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: outcomes.ListOutcomesHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/:id",
					Handler: outcomes.GetOutcomeHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/conversion",
					Handler: outcomes.ReportConversionHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/:id/conversion",
					Handler: outcomes.UpdateConversionHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/:id/conversion",
					Handler: outcomes.DeleteConversionHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/summary",
					Handler: outcomes.GetOutcomeSummaryHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/outcomes"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: ownposts.ListOwnPostsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/analyze",
					Handler: ownposts.OwnPostAnalyzeHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/generate-reply",
					Handler: ownposts.OwnPostGenerateReplyHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/last-synced-at",
					Handler: ownposts.OwnPostsLastSyncedHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/load-replies",
					Handler: ownposts.OwnPostLoadRepliesHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/manage-reply",
					Handler: ownposts.OwnPostManageReplyHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/reply-control",
					Handler: ownposts.OwnPostSetReplyControlHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/send-reply",
					Handler: ownposts.OwnPostSendReplyHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/sync",
					Handler: ownposts.SyncOwnPostsHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/own-posts"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: personas.ListPersonasHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/",
					Handler: personas.SavePersonaHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/:id",
					Handler: personas.GetPersonaHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/:id",
					Handler: personas.RemovePersonaHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/analyze-account",
					Handler: personas.AnalyzePersonaAccountHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/analyze-text",
					Handler: personas.AnalyzePersonaTextHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/active",
					Handler: personas.GetActivePersonaHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/active",
					Handler: personas.SetActivePersonaHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/personas"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodGet,
				Path:    "/health",
				Handler: ping.HealthHandler(serverCtx),
			},
			{
				Method:  http.MethodGet,
				Path:    "/ping",
				Handler: ping.PingHandler(serverCtx),
			},
		},
		rest.WithPrefix("/api/v1"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: playbooks.ListPlaybooksHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/",
					Handler: playbooks.PublishPlaybookHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/:id",
					Handler: playbooks.GetPlaybookHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/:id",
					Handler: playbooks.RemovePlaybookHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/import",
					Handler: playbooks.ImportPlaybookHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/playbooks"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: plays.ListPlaysHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/",
					Handler: plays.SavePlayHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/:id",
					Handler: plays.GetPlayHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/:id",
					Handler: plays.RemovePlayHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/generate-script",
					Handler: plays.GeneratePlayScriptHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/submit",
					Handler: plays.SubmitPlayHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/by-external",
					Handler: plays.ListPlaysByExternalHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/by-post",
					Handler: plays.ListPlaysByPostHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/generate-step",
					Handler: plays.GeneratePlayStepHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/resolve-external",
					Handler: plays.ResolveExternalLinkHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/plays"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/ai/complete",
					Handler: proxy.AICompleteHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/search",
					Handler: proxy.ExaSearchHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/proxy"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodPost,
				Path:    "/pain-keywords",
				Handler: publictools.PublicPainKeywordsHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/style-quiz",
				Handler: publictools.PublicStyleQuizHandler(serverCtx),
			},
		},
		rest.WithPrefix("/api/v1/public/tools"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodGet,
				Path:    "/:code",
				Handler: publicutm.UtmRedirectHandler(serverCtx),
			},
		},
		rest.WithPrefix("/api/v1/public/u"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/cost-preview",
					Handler: radar.GetRadarCostPreviewHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/explore",
					Handler: radar.ExploreOpportunitiesHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/import",
					Handler: radar.ImportOpportunitiesHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/opportunities",
					Handler: radar.ListOpportunitiesHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/opportunities/:id",
					Handler: radar.GetOpportunityHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/opportunities/:id/accept",
					Handler: radar.AcceptOpportunityHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/opportunities/:id/dismiss",
					Handler: radar.DismissOpportunityHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/opportunities/:id/override",
					Handler: radar.OverrideOpportunityHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/opportunities/:id/primary-product",
					Handler: radar.SetPrimaryProductHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/opportunities/:id/replies",
					Handler: radar.ListOpportunityRepliesHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/opportunities/:id/replies",
					Handler: radar.CreateOpportunityReplyHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/opportunities/:id/replies/:replyId/mark-used",
					Handler: radar.MarkOpportunityReplyUsedHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/opportunities/:id/review-state",
					Handler: radar.UpdateOpportunityReviewStateHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/products/:productId/demand-map",
					Handler: radar.GetDemandMapHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/products/:productId/demand-map",
					Handler: radar.UpdateDemandMapHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/products/:productId/demand-map/enrich",
					Handler: radar.EnrichDemandMapHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/service-profile",
					Handler: radar.GetServiceProfileHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/service-profile",
					Handler: radar.UpsertServiceProfileHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/sweeps",
					Handler: radar.ListSweepsHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/today",
					Handler: radar.GetRadarTodayHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/watches",
					Handler: radar.ListWatchesHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/watches",
					Handler: radar.CreateWatchHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/watches/:id",
					Handler: radar.GetWatchHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/watches/:id",
					Handler: radar.UpdateWatchHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/watches/:id",
					Handler: radar.ArchiveWatchHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/watches/:id/assign-product",
					Handler: radar.AssignWatchProductHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/watches/:id/pause",
					Handler: radar.PauseWatchHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/watches/:id/purge",
					Handler: radar.DeleteArchivedWatchHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/watches/:id/resume",
					Handler: radar.ResumeWatchHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/watches/:id/sweep",
					Handler: radar.TriggerWatchSweepHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/watches/suggest",
					Handler: radar.SuggestWatchTermsHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/radar"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/search",
					Handler: research.ResearchSearchHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/research"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/brands",
					Handler: scout.ListBrandsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/brands",
					Handler: scout.SaveBrandHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/brands-active",
					Handler: scout.GetActiveBrandHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/brands-active",
					Handler: scout.SetActiveBrandHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/brands/:id",
					Handler: scout.GetBrandHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/brands/:id",
					Handler: scout.RemoveBrandHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/brief",
					Handler: scout.PrepareBriefHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/crawler-session",
					Handler: scout.SetCrawlerSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/crawler-session",
					Handler: scout.ClearCrawlerSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/homework",
					Handler: scout.ListHomeworkHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/homework",
					Handler: scout.SaveHomeworkHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/homework/:themeKey",
					Handler: scout.GetHomeworkHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/homework/:themeKey",
					Handler: scout.RemoveHomeworkHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/posts",
					Handler: scout.ListScoutPostsHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/posts/:id",
					Handler: scout.RemoveScoutPostHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/posts/:id/draft",
					Handler: scout.DraftOutreachHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/posts/:id/mark-published",
					Handler: scout.MarkPublishedHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/posts/:id/promote",
					Handler: scout.PromoteScoutPostHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/posts/:id/send",
					Handler: scout.SendOutreachHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/posts/:id/skip",
					Handler: scout.SkipOutreachHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/products",
					Handler: scout.ListProductsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/products",
					Handler: scout.SaveProductHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/products/:id",
					Handler: scout.GetProductHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/products/:id",
					Handler: scout.RemoveProductHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/products/all",
					Handler: scout.ListAllProductsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/products/import",
					Handler: scout.ImportProductHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/runs",
					Handler: scout.ListScoutRunsHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/runs/:runId",
					Handler: scout.RemoveScoutRunHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/runs/:runId/posts",
					Handler: scout.ListScoutRunPostsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/scan",
					Handler: scout.RunScanHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/themes/:themeKey",
					Handler: scout.RemoveScoutThemeHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/scout"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/ai",
					Handler: settings.GetAiHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/ai",
					Handler: settings.SaveAiHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/models",
					Handler: settings.ListModelsHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/placement",
					Handler: settings.GetPlacementHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/placement",
					Handler: settings.SavePlacementHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/threads",
					Handler: settings.GetThreadsHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/settings"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodGet,
				Path:    "/oauth/callback",
				Handler: threads.ThreadsOAuthCallbackHandler(serverCtx),
			},
		},
		rest.WithPrefix("/api/v1/threads-accounts"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: threads.ListThreadsAccountsHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/:id",
					Handler: threads.DisconnectThreadsAccountHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/refresh",
					Handler: threads.RefreshThreadsAccountHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/session/import",
					Handler: threads.ImportThreadsAccountSessionHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/oauth/start",
					Handler: threads.ThreadsOAuthStartHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/threads-accounts"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/events",
					Handler: usage.ListUsageEventsHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/prefs",
					Handler: usage.GetUsagePrefsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/purchase",
					Handler: usage.PurchasePlanHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/purchases",
					Handler: usage.ListMyPurchasesHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/summary",
					Handler: usage.GetUsageSummaryHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/usage"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT, serverCtx.AdminAuth},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/prefs",
					Handler: usage.SetUsagePrefsHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/tenant-analytics",
					Handler: usage.GetTenantUsageAnalyticsHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/tenant-summary",
					Handler: usage.GetTenantUsageSummaryHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
		rest.WithPrefix("/api/v1/usage"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/links",
					Handler: utm.CreateUtmLinkHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/links",
					Handler: utm.ListUtmLinksHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/utm"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodPut,
					Path:    "/:id/branding",
					Handler: workspaces.UpdateWorkspaceBrandingHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/:id/members",
					Handler: workspaces.ListWorkspaceMembersHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/members",
					Handler: workspaces.AddWorkspaceMemberHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/:id/members/:uid",
					Handler: workspaces.RemoveWorkspaceMemberHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/workspaces"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.AuthJWT},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/",
					Handler: workspaces.ListWorkspacesHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/",
					Handler: workspaces.CreateWorkspaceHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/:id",
					Handler: workspaces.UpdateWorkspaceHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/archive",
					Handler: workspaces.ArchiveWorkspaceHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/:id/switch",
					Handler: workspaces.SwitchWorkspaceHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/report/export",
					Handler: workspaces.ExportWorkspaceReportHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/reviews",
					Handler: workspaces.SubmitDraftReviewHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/reviews",
					Handler: workspaces.ListDraftReviewsHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/reviews/:id/approve",
					Handler: workspaces.ApproveDraftReviewHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/reviews/:id/reject",
					Handler: workspaces.RejectDraftReviewHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/api/v1/workspaces"),
	)
}
