package routes

import (
	"git.trj.tw/golang/mtgbot/modules/context"
	"git.trj.tw/golang/mtgbot/router/line"
	"github.com/gin-gonic/gin"
)

var r *gin.Engine

// NewEngine - new gin engine
func NewEngine() *gin.Engine {
	r = gin.Default()

	return r
}

// SetRoutes -
func SetRoutes(r *gin.Engine) {
	r.GET("/", func(c *gin.Context) {
		c.String(200, "Hello")
	})

	r.POST("/line", context.PatchCtx(line.GetRawBody), context.PatchCtx(line.VerifyLine), context.PatchCtx(line.LineWebhook))
	r.POST("/line/", context.PatchCtx(line.GetRawBody), context.PatchCtx(line.VerifyLine), context.PatchCtx(line.LineWebhook))

}
