/**
* Created by GoLand.
* User: link1st
* Date: 2019-07-25
* Time: 12:20
 */

package routers

import (
	"gowebsocket/controllers/docker"
	"gowebsocket/controllers/home"
	"gowebsocket/controllers/rtc"
	"gowebsocket/controllers/systems"
	"gowebsocket/controllers/user"

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

func Init(router *gin.Engine) {
	router.LoadHTMLGlob("views/**/*")

	// 用户组
	userRouter := router.Group("/user")
	{
		userRouter.GET("/list", user.List)
		userRouter.GET("/online", user.Online)
		userRouter.POST("/sendMessage", user.SendMessage)
		userRouter.POST("/sendMessageAll", user.SendMessageAll)
	}

	// 系统
	systemRouter := router.Group("/system")
	{
		systemRouter.GET("/state", systems.Status)
	}

	// home
	homeRouter := router.Group("/home")
	{
		homeRouter.GET("/index", home.Index)
	}

	// rtc
	rtcRouter := router.Group("/rtc")
	{
		rtcRouter.GET("/get_token", rtc.GetToken)
	}

	// docker
	dockerRouter := router.Group("/docker")
	{
		dockerRouter.GET("/run", docker.Run)
	}

	// router.POST("/user/online", user.Online)
}
