package globals

import "netease_control_center/interfaces/log"

type PlatformConfig struct {
	MicAdc bool
	InputKeyPath string
}
var (
		platformConfigs = map[string]PlatformConfig{
			"default": PlatformConfig{MicAdc:false, InputKeyPath:"/dev/input/event2"},
			"EVT":PlatformConfig{MicAdc:true, InputKeyPath:"/dev/input/event2"},
			"r311-pv1":PlatformConfig{MicAdc:false, InputKeyPath:"/dev/input/event1"},
		}
		curPlatformConfig *PlatformConfig
)

func GetCurPlatformConfig() PlatformConfig {
	if curPlatformConfig != nil {
		return *curPlatformConfig
	}

	if Hv == nil {
		log.Println(log.ErrorLog, "Can not get the right platform, hv is nil!")
		return platformConfigs["default"]
	}

	queryString := *Hv
	if queryString == "DVT" {
		queryString = "EVT"
	}
	if tmp,ok := platformConfigs[*Hv]; ok {
		curPlatformConfig = &tmp
		return tmp
	} else {
		return platformConfigs["default"]
	}
}