package router

import (
	"github.com/gin-gonic/gin"
	jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"

	"go-admin/app/admin/apis"
	"go-admin/common/actions"
	"go-admin/common/middleware"
)

func init() {
	routerCheckRole = append(routerCheckRole, registerLineSymbolRouter)
}

// registerLineSymbolRouter
func registerLineSymbolRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	api := apis.LineSymbol{}
	r := v1.Group("/line-symbol").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
	{
		r.GET("", actions.PermissionAction(), api.GetPage)
		r.GET("getSameSymbol", actions.PermissionAction(), api.GetSameSymbol) //获取现货和合约都有的交易对
		r.GET("/:id", actions.PermissionAction(), api.Get)
		r.POST("", api.Insert)
		r.PUT("/:id", actions.PermissionAction(), api.Update)
		r.DELETE("", api.Delete)

		r.POST("syncSpotSymbol", api.SyncSpotSymbol) //同步现货交易对
		r.POST("syncFutSymbol", api.SyncFutSymbol)   //同步合约交易对
		r.POST("getSymbol", api.GetSymbol)           //获取现货和合约都有的交易对
		r.GET("/export", api.Export)                 //导出交易对

		r.GET("/all", api.GetAll) //获取所有交易对
	}
}
