package schedule

import (
	model "LAPP_LF_MOM_BACKEND/models/base"
	"LAPP_LF_MOM_BACKEND/utils"
)

type CalendarSrv struct {
	CalendarNr		int
	CalDayDict		map[string]int		// 用于存储特殊工作日的日模型
	WorkCalTab		model.WorkCalendar
}

// 初始化
func(calsrv *CalendarSrv)Init(caltab model.WorkCalendar){
	var i		int

	calsrv.WorkCalTab	= caltab
	calsrv.CalendarNr 	= calsrv.WorkCalTab.WorkCalendarNr
	calsrv.CalDayDict	= make(map[string]int)
	for i = 0; i < len(caltab.WorkCalendarLstLi); i++ {
		WorkTime := caltab.WorkCalendarLstLi[i].WorkDate.Restore()
		WorkDate := utils.TimeFormat(WorkTime,"yyyy-MM-dd")
		calsrv.CalDayDict[WorkDate] = caltab.WorkCalendarLstLi[i].DayModelNr
	}
}