Files
zarinpal-analytics-backend/internal/growth/catalog.go

38 lines
2.0 KiB
Go

package growth
import "time"
const officialCalendarSource = "https://calendar.ut.ac.ir/"
const curatedCommercialSource = "CURATED_COMMERCIAL_1405_V1"
// Catalog1405 returns a defensive copy of the reviewed initial catalog. Dates are
// Gregorian Tehran-local calendar dates and cover the imported 1405 history plus
// the first 90 forecast days after 2026-06-30.
func Catalog1405() []Event {
events := []Event{
catalogEvent("nowruz-1405", "نوروز", "2026-03-21", "2026-03-24", "new-year", EventOfficial, []string{"هدیه", "خرید", "سال-نو"}),
catalogEvent("nature-day-1405", "روز طبیعت", "2026-04-02", "2026-04-02", "leisure", EventOfficial, []string{"تفریح", "خرید"}),
catalogEvent("teachers-day-1405", "روز معلم", "2026-05-02", "2026-05-02", "appreciation", EventOfficial, []string{"هدیه", "آموزش", "قدردانی"}),
catalogEvent("khordad-15-1405", "قیام پانزده خرداد", "2026-06-05", "2026-06-05", "official-holiday", EventOfficial, []string{"تعطیل"}),
catalogEvent("fathers-day-commercial-1405", "روز پدر", "2026-08-25", "2026-08-25", "appreciation", EventCommercial, []string{"هدیه", "خرید", "قدردانی"}),
catalogEvent("back-to-school-1405", "آمادگی بازگشایی مدارس", "2026-09-10", "2026-09-22", "education-season", EventCommercial, []string{"آموزش", "خرید", "مدرسه"}),
}
return append([]Event(nil), events...)
}
func catalogEvent(id, title, start, end, family string, kind EventKind, tags []string) Event {
source := officialCalendarSource
if kind == EventCommercial {
source = curatedCommercialSource
}
return Event{ID: id, TitleFA: title, StartDate: mustCatalogDate(start), EndDate: mustCatalogDate(end), Family: family, Tags: append([]string(nil), tags...), Source: source, Kind: kind}
}
func mustCatalogDate(value string) time.Time {
parsed, err := time.Parse(time.DateOnly, value)
if err != nil {
panic("invalid reviewed event catalog date: " + value)
}
return parsed
}