package main

import (
	"github.com/gin-gonic/gin"
	"github.com/swaggo/files"       // swagger embed files
	"github.com/swaggo/gin-swagger" // gin-swagger middleware
	"io.wdd.message_pusher/docs"
	"io.wdd.message_pusher/router"
)

// @title           Swagger Example API
// @version         1.0
// @description     This is a sample server celler server.
// @termsOfService  http://swagger.io/terms/

// @contact.name   API Support
// @contact.url    http://www.swagger.io/support
// @contact.email  support@swagger.io

// @license.name  Apache 2.0
// @license.url   http://www.apache.org/licenses/LICENSE-2.0.html

// @host      localhost:8080
// @BasePath

// @securityDefinitions.basic  BasicAuth

// @externalDocs.description  OpenAPI
// @externalDocs.url          https://swagger.io/resources/open-api/
func main() {

	engine := gin.Default()
	// programmatically set swagger info
	docs.SwaggerInfo.Title = "Wdd Message Pusher"
	docs.SwaggerInfo.Description = "Wdd Message Pusher Service"
	docs.SwaggerInfo.Version = "1.0"
	docs.SwaggerInfo.Host = "localhost:8080"
	docs.SwaggerInfo.BasePath = ""
	docs.SwaggerInfo.Schemes = []string{"http"}

	// 强制日志颜色化
	gin.ForceConsoleColor()

	// 定义路由组
	{
		router.CMIIRouter(engine)
		router.OctopusRouter(engine)
		router.ImageSyncRouter(engine)
	}

	engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	err := engine.Run(":8080")
	if err != nil {
		panic(err)
	}
}
