package router

import (
	"fonchain-fiee/pkg/middleware"
	"fonchain-fiee/pkg/service"
	"fonchain-fiee/pkg/service/bundle"

	"github.com/gin-gonic/gin"
)

func BundleRouter(r *gin.RouterGroup) {
	bundleRoute := r.Group("bundle")
	bundleRoute.Use(middleware.CheckWebLogin(service.AccountProvider))
	bundleAppRoute := r.Group("bundle")
	bundleAppNoAuthRoute := r.Group("bundle")
	bundleAppRoute.Use(middleware.CheckLogin(service.AccountFieeProvider))
	bundleClientNoAuthRoute := r.Group("bundle/no-auth")
	// 套餐
	{
		{
			bundleClientNoAuthRoute.POST("export/work-cast-info", bundle.ExportWorkCastInfo)
			bundleClientNoAuthRoute.POST("export/bundle-price-info", bundle.ExportBundlePriceInfo)
			bundleClientNoAuthRoute.POST("survey/is-send", bundle.IsSendSurvey)
			bundleClientNoAuthRoute.POST("survey/bundleInfo", bundle.QuestionnaireSurveyBundleInfo)
			bundleClientNoAuthRoute.POST("survey/create", bundle.QuestionnaireSurveyCreate)
		}
		bundleClientRoute := bundleRoute.Group("system")
		{
			bundleClientRoute.POST("create", bundle.CreateBundle)
			bundleClientRoute.POST("update", bundle.UpdateBundle)
			bundleClientRoute.POST("remove", bundle.DeleteBundle)
			bundleClientRoute.POST("bundle-list", bundle.BundleList)
			bundleClientRoute.POST("add-value/only", bundle.OnlyAddValueListByOrderNo)

			bundleExtend := bundleClientRoute.Group("extend")
			{
				bundleExtend.POST("", bundle.BundleExtend)
				bundleExtend.POST("list", bundle.BundleExtendRecordsList)
			}
			bundleBalance := bundleClientRoute.Group("balance")
			{
				bundleBalance.POST("list", bundle.GetBundleBalance)
				bundleBalance.POST("account/list", bundle.GetAccountBundleBalance)
				bundleBalance.POST("used-record", bundle.GetUsedRecordList)
				bundleBalance.POST("activate", bundle.BundleActivate)
				bundleBalance.POST("export", bundle.BundleExport)
				bundleBalance.POST("layout-update", bundle.SetBalanceLayout)
				bundleBalance.POST("layout", bundle.GetBalanceLayout)
			}
			metrics := bundleClientRoute.Group("metrics")
			{
				metrics.POST("business", bundle.MetricsBusiness)
				metrics.POST("operator-create", bundle.MetricsOpratorCreate)
				metrics.POST("operator-status", bundle.MetricsOpratorStatus)
				metrics.POST("export/bundle-purchase", bundle.MetricsBundlePurchaseExport)
				metrics.POST("export/artist-account", bundle.MetricsArtistAccountExport)
				metrics.POST("export/video-submit", bundle.MetricsVideoSubmitExport)
				metrics.POST("export/balance-detail", bundle.MetricsBalanceDetailExport)
				metrics.POST("export/balance-metrics", bundle.BalanceMetricsExport)
			}
			survey := bundleClientRoute.Group("survey")
			{
				survey.POST("list", bundle.QuestionnaireSurveyList)
			}

		}
		bundleClientRouteV2 := bundleRoute.Group("system/v2")
		{
			bundleClientRouteV2.POST("save", bundle.SaveBundleV2)
			bundleClientRouteV2.POST("update/shelfStatus", bundle.HandShelf)
			bundleClientRouteV2.POST("bundle-list", bundle.BundleListV2)
			bundleClientRouteV2.POST("bundle-detail", bundle.BundleDetailV2)
		}
		bundleAppRouteV1 := bundleAppRoute.Group("common")
		{
			bundleAppRouteV1.POST("bundle-list", bundle.BundleList)
			bundleAppRoute.POST("bundle-list", bundle.BundleList)

			bundleAppRoute.POST("pending-confirmation-list", bundle.GetToBeComfirmedWorks) // 作品状态变更的待确认记录
			bundleAppRoute.POST("confirm-cast-log", bundle.CastLogConfirm)                 // 对变更记录进行确认

			bundleAppRoute.POST("balance", bundle.GetUserBalance)
			bundleAppRoute.POST("work-detail", bundle.GetWorkDetail)
			bundleAppRoute.POST("work-confirm", bundle.WorkConfirm)
		}
		bundleAppRouteV2 := bundleAppRoute.Group("app/system/v2")
		{
			bundleAppRouteV2.POST("add-value/only", bundle.OnlyAddValueListByOrderNo)
		}
		bundleAppNoAuthRouteV2 := bundleAppNoAuthRoute.Group("app/system/v2")
		{
			bundleAppNoAuthRouteV2.POST("bundle-list", bundle.BundleListH5V2)
			bundleAppNoAuthRouteV2.POST("bundle-detail", bundle.BundleDetailV2)

		}
	}

}
