package vui

import "time"

type DayIntervalName uint8

const (
	DayInterval_Morning DayIntervalName = iota
	DayInterval_forenoon
	DayInterval_Afternoon
	DayInterval_Night
	DayInterval_Unknow
)

func (this *DayIntervalName) String() string {
	switch *this {
	case DayInterval_Morning:
		return "早上"
	case DayInterval_forenoon:
		return "上午"
	case DayInterval_Afternoon:
		return "下午"
	case DayInterval_Night:
		return "晚上"
	case DayInterval_Unknow:
		return "未知"
	}
	return ""
}

func GetCurDayIntervalName() DayIntervalName {
	hour := time.Now().Hour()
	return GetCurDayIntervalNameByHour(hour)
}

func GetCurDayIntervalNameByHour(hour int) DayIntervalName {
	switch {
	case hour >= 4 && hour < 9:
		return DayInterval_Morning

	case hour >= 9 && hour < 13:
		return DayInterval_forenoon

	case hour >= 13 && hour < 19:
		return DayInterval_Afternoon

	case hour >= 19 || hour < 4:
		return DayInterval_Night
	}

	return DayInterval_Unknow
}
