package handlers

import "net/http"

// Server-rendered page endpoints for the Phase E Deadlines UI.
// HTML is generated at build time by frontend/build.ts; the per-page
// client TS bundles call /api/deadlines* to populate the DOM and read
// id/project_id from window.location.

// handleDeadlinesListRedirect 301-redirects the legacy /deadlines list URL
// to the canonical /events?type=deadline (t-paliad-115). Detail page
// /deadlines/{id} stays type-specific. Drop this redirect once we're
// confident no caches / bookmarks / external links still hit the old URL.
func handleDeadlinesListRedirect(w http.ResponseWriter, r *http.Request) {
	http.Redirect(w, r, "/events?type=deadline", http.StatusMovedPermanently)
}

func handleDeadlinesNewPage(w http.ResponseWriter, r *http.Request) {
	http.ServeFile(w, r, "dist/deadlines-new.html")
}

func handleDeadlinesDetailPage(w http.ResponseWriter, r *http.Request) {
	http.ServeFile(w, r, "dist/deadlines-detail.html")
}

func handleDeadlinesCalendarPage(w http.ResponseWriter, r *http.Request) {
	http.ServeFile(w, r, "dist/deadlines-calendar.html")
}
