package globals

const (
	MSC_CMD_ONE_SHOT        string = "快捷命令"
	MSC_CMD_ONE_SHOT_WAKEUP string = "快捷命令WakeupbyMain" //被唤醒后的快捷指令
)

//唤醒词
const (
	MainWakeupWord = "di da di da"
	NextSongWord   = "xia yi shou"
	VolumeUpWord   = "da sheng yi dian"
	VolumeDownWord = "xiao sheng yi dian"
)

type WakeupWordsType uint8

//唤醒支持列表,和服务器顺序保持一致
//注意如需要动顺序请和服务器同步
const (
	MainWakeup   WakeupWordsType = iota + 0 //主唤醒词
	NextSong                                //下一首
	VolumeAdjust                            //大声一点,小声一点
	MaxWords
)

type wakeupVal struct {
	WkupWord     string //唤醒词
	DayThresh    string //白天阈值
	NightThresh  string //夜间阈值
	Major        string //主唤醒词设置
	Dcheck       string //是否开启唤醒识别检测
	DayThresh2   string //白天大音量下的阈值，通常比thresh要低
	NightThresh2 string //夜间大音量下的阈值，通常比thresh要低
}

type OneShotArray struct {
	Words []WakeupWordsType `json:"words"`
}

var (
	OneShot   OneShotArray
	WkupArray = [MaxWords]wakeupVal{
		MainWakeup:   wakeupVal{WkupWord: MainWakeupWord, DayThresh: "0.52", NightThresh: "0.59", Major: "0", Dcheck: "0", DayThresh2: "0.36", NightThresh2: "0.36"},
		NextSong:     wakeupVal{WkupWord: NextSongWord, DayThresh: "0.43", NightThresh: "0.49", Major: "0", Dcheck: "0", DayThresh2: "0.28", NightThresh2: "0.28"},
		VolumeAdjust: wakeupVal{WkupWord: string(VolumeUpWord + "," + VolumeDownWord), DayThresh: "0.33,0.35", NightThresh: "0.37,0.40", Major: "0,0", Dcheck: "0,0", DayThresh2: "0.25,0.23", NightThresh2: "0.25,0.23"},
	}
)

//查看是否打开了实验室某个唤醒功能
func IsWakeupCmdEnable(cmd WakeupWordsType) bool {
	for _, value := range OneShot.Words {
		if value == cmd {
			return true
		}
	}
	return false
}
