package configs

import (
	"log"
	"os"
	"path/filepath"
	"strings"
)

const (
	// ProjectName 项目名称
	ProjectName = "mini-chat"

	// ProjectPort 项目端口
	ProjectPort = ":9991"

	// ProjectAccessLogFile 项目访问日志存放文件
	ProjectAccessLogFile = "./logs/" + ProjectName + "-access.log"

	// ZhCN 简体中文 - 中国
	ZhCN = "zh-cn"

	// EnUS 英文 - 美国
	EnUS = "en-us"

	// CustomerProjectNameZh 客户项目中文名称
	CustomerProjectNameZh = "盲盒游戏"

	// CustomerProjectNameEn 客户项目英文名称
	CustomerProjectNameEn = "Bindbox Game"

	// CustomerProjectVersion 客户项目版本
	CustomerProjectVersion = "Release-2025111111"
)

// GetResourcesFilePath 获取资源文件路径
func GetResourcesFilePath() string {
	return filepath.Join(getProjectPath(), "resources")
}

// getProjectPath 获取项目路径
func getProjectPath() string {
	executablePath, err := os.Executable()
	if err != nil {
		log.Println("Error getting executable path:", err)
		return ""
	}

	// 检查路径是否含有临时目录特征，这里仅为示例，实际情况可能需要更复杂的判断
	if strings.Contains(executablePath, "/tmp/") || strings.Contains(executablePath, "var/folders/") {
		return ""
	} else {
		return filepath.Dir(executablePath)
	}
}
