package briefing import ( "time" "gitea.maximumdirect.net/eric/weatherreporter/internal/module" "gitea.maximumdirect.net/eric/weatherreporter/internal/timeutil" ) type WeatherStoryModule struct { Available bool `json:"available"` OfficeID string `json:"office_id,omitempty"` PeriodBegins string `json:"period_begins,omitempty"` PeriodEnds string `json:"period_ends,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` AltText string `json:"alt_text,omitempty"` Priority bool `json:"priority"` Order int `json:"order"` DownloadURL string `json:"download_url,omitempty"` } func buildWeatherStoryModule(ctx ModuleContext, _ any) (*module.Output, error) { story := ctx.Collected.WeatherStory if story == nil { return nil, nil } period := timeutil.Period{Start: story.StartTime, End: story.EndTime} value := WeatherStoryModule{ Available: true, OfficeID: story.OfficeID, PeriodBegins: friendlyPeriodBeginsLabel(period, ctx.Timezone), PeriodEnds: friendlyPeriodEndsLabel(period, ctx.Timezone), UpdatedAt: copyTime(story.UpdatedAt), Title: story.Title, Description: story.Description, AltText: story.AltText, Priority: story.Priority, Order: story.Order, DownloadURL: story.DownloadURL, } return &module.Output{ID: module.WeatherStory, StanzaName: "weather_story", Value: value}, nil }