package test

import (
	"netease_control_center/globals"
	"netease_control_center/interfaces/log"
	"os"
)

const (
	TTS_XUNFEI_FILE = "/mnt/UDISK/xunfei.tts"
	TTS_XIAOYA_FILE = "/mnt/UDISK/xiaoya.tts"
	TTS_ROKID_FILE  = "/mnt/UDISK/rokid.tts"
)

type DebugInfo struct {
	Val      interface{}
	TrueVal  interface{}
	FalseVal interface{}
}

var (
	DebugCfg map[string]DebugInfo = map[string]DebugInfo{
		TTS_XUNFEI_FILE: DebugInfo{Val: &globals.TtsSel, TrueVal: globals.XUNFEI_TTS, FalseVal: globals.TtsSel},
		TTS_XIAOYA_FILE: DebugInfo{Val: &globals.TtsSel, TrueVal: globals.XIAOYA_TTS, FalseVal: globals.TtsSel},
		TTS_ROKID_FILE:  DebugInfo{Val: &globals.TtsSel, TrueVal: globals.ROKID_TTS_TEXT, FalseVal: globals.TtsSel},
	}
)

func DebugCfgInit() {

	for k, v := range DebugCfg {
		_, err := os.Stat(k)
		if nil == err {
			switch e := v.Val.(type) {
			case *string:
				*e = v.TrueVal.(string)
				log.Println(log.DebugLog, k, " exists, ", "  v.Val:", *e)
			case *uint8:
				*e = v.TrueVal.(uint8)
				log.Println(log.DebugLog, k, " exists, ", "  v.Val:", *e)
			default:

			}
		}
	}
}
