package initApp

import (
	_ "DataShare/docs"
	"DataShare/handler"
	"DataShare/middleware"
	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
)
func RoutersInit()  *gin.Engine{
	var Router = gin.Default()

	Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	Router.Use(middleware.Cors())
	Router.Use(middleware.LogHook())
	Router.Use(gin.Recovery())

	//DXP
	dxpGroup := Router.Group("/dxp/database/")
	handler.DxpApi_RouteInit(dxpGroup)
	//license

	dxpCore := Router.Group("/dxp/core/")
	handler.DxpCore_RouteInit(dxpCore)
	//todo
	//innerGroup := Router.Group("/api/v1/datashare/inapi/")
	//handler.InnerApi_RouteInit(innerGroup)
	outerGroup := Router.Group("/dxp/outapi/base")
	handler.OutApi_RouteInit(outerGroup)

	//outerGroup = Router.Group("/dxp/outapi/base/proxyToService")
	//handler.OutApi_RouteServiceInit(outerGroup)
	//
	//outerGroup = Router.Group("/dxp/outapi/base/proxyToData")
	//handler.OutApi_RouteDataInit(outerGroup)

	outerGroup2 := Router.Group("/dxp/outapi/")

	//outerGroup2.Use(middleware.TokenAuthMiddleware())
	handler.OutApi_RouteInit2(outerGroup2)




	return Router
}
