package g

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gcfg"
	"go.uber.org/zap"
	"net/http"
	"tgk-touch/internal/model/config"
	"tgk-touch/utility/timer"
)

var (
	GVA_Timer        timer.Timer = timer.NewTimerTask()
	GVA_HttpServeMux             = http.NewServeMux()
	GVA_Config       config.AppConfig
	GVA_LOG          *zap.Logger
	GVA_HttpServer   *http.Server
)

func HttpServerMux() *http.ServeMux {
	return GVA_HttpServeMux
}
func HttpServer() *http.Server {
	return GVA_HttpServer
}

func Timer() timer.Timer {
	return GVA_Timer
}
func Config() config.AppConfig {
	return GVA_Config
}
func Cfg() *gcfg.Config {
	return g.Cfg()
}
func Log() *zap.SugaredLogger {
	if GVA_LOG == nil {
		return zap.S()
	}
	return GVA_LOG.Sugar()
}
func JsonLog() *zap.Logger {
	if GVA_LOG == nil {
		return zap.L()
	}
	return GVA_LOG
}
