package views

// PlanningEventRow holds data for a single event row in the planning agenda.
type PlanningEventRow struct {
	DateLabel  string
	TimeRange  string
	Title      string
	TabloTitle string
	Location   string
}

// PlanningTabData is the view model for the planning page.
type PlanningTabData struct {
	Events    []PlanningEventRow
	DateRange string
}

// NewPlanningTabData returns a PlanningTabData with static demo events spanning 2 dates.
func NewPlanningTabData() PlanningTabData {
	return PlanningTabData{
		DateRange: "May 17 – May 30, 2026",
		Events: []PlanningEventRow{
			{DateLabel: "May 17, 2026", TimeRange: "09:00-10:00", Title: "Sprint Planning", TabloTitle: "Product", Location: "Room A"},
			{DateLabel: "May 17, 2026", TimeRange: "11:00-12:00", Title: "Design Review", TabloTitle: "Design", Location: ""},
			{DateLabel: "May 17, 2026", TimeRange: "14:00-15:00", Title: "Stakeholder Sync", TabloTitle: "Product", Location: "HQ"},
			{DateLabel: "May 18, 2026", TimeRange: "10:00-11:00", Title: "Engineering Stand-up", TabloTitle: "Engineering", Location: ""},
			{DateLabel: "May 18, 2026", TimeRange: "15:00-16:00", Title: "Retrospective", TabloTitle: "Product", Location: "Room B"},
		},
	}
}

// PlanningShowDaySeparator returns true when a day separator header should be
// rendered before the event at index. The separator is shown for the first
// event (index 0) or whenever the date label changes from the previous event.
func PlanningShowDaySeparator(events []PlanningEventRow, index int) bool {
	if index == 0 {
		return true
	}
	return events[index].DateLabel != events[index-1].DateLabel
}
