package cserveraddr

/*
#cgo CFLAGS: -fvisibility=hidden
#cgo LDFLAGS:-lpthread -ldl -lstdc++ -lrt -lm -lc -lz -luv -lcjson -luvdbus -lcurl -lcrypto -ldbus-1 -lsqlite3 -ls2json -lquickmail -luuid -lcutils -lconfig
#include <stdio.h>
#include <stdlib.h>
#include <uvdbus/skins.h>
#include <uvdbus/libuv_dbus.h>
#include <uvdbus/server_addr.h>
*/
import "C"

type DEVENV int

const (
	DEVENV_DEVELOP    DEVENV = 0
	DEVENV_TEST       DEVENV = 1
	DEVENV_PUBLISH    DEVENV = 2
	DEVENV_PRERELEASE DEVENV = 3
)

func InitCserveraddr() {
	C.ServerManagerInit()
}

func GetServerAddr() string {
	return C.GoString(C.GetCurServerAddr(C.SERVER_MODULE))
}

func GetTtsServerAddr() string {
	return C.GoString(C.GetCurServerAddr(C.TTS_MODULE))
}

func SetDevEnv(env DEVENV) {
	C.SetCurrentServerMode(C.SERVER_MODE_TYPE(env))
}

func GetDevEnv() DEVENV {
	return DEVENV(C.GetCurrentServerMode())
}
