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")
	bundleAppRoute.Use(middleware.CheckLogin(service.AccountFieeProvider))
	// 套餐
	{
		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)

			bundleExtend := bundleClientRoute.Group("extend")
			{
				bundleExtend.POST("", bundle.BundleExtend)
				bundleExtend.POST("list", bundle.BundleExtendRecordsList)
			}
			bundleBalance := bundleClientRoute.Group("balance")
			{
				bundleBalance.POST("list", bundle.GetBundleBalance)
				bundleBalance.POST("list", bundle.GetBundleBalance)
				bundleBalance.POST("used-record", bundle.GetUsedRecordList)
			}
		}
		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)
		}
		bundleAppRouteV2 := bundleAppRoute.Group("app/system/v2")
		{
			bundleAppRouteV2.POST("bundle-list", bundle.BundleListV2)
			bundleAppRouteV2.POST("bundle-detail", bundle.BundleDetailV2)

			bundleAppRoute.POST("pending-confirmation-list", bundle.GetToBeComfirmedWorks)
			bundleAppRoute.POST("balance", bundle.GetUserBalance)
			bundleAppRoute.POST("work-detail", bundle.GetWorkDetail)
			bundleAppRoute.POST("work-confirm", bundle.WorkConfirm)
		}

	}

}
