package html

import (
	"net/http"
	"strconv"
	"strings"
)

func errorMessage(statusCode int) string {
	message := http.StatusText(statusCode)

	switch statusCode {
	case http.StatusMisdirectedRequest:
		message += " - domain not specified in <code>.domains</code> file"
	case http.StatusFailedDependency:
		message += " - target repo/branch doesn't exist or is private"
	}

	return message
}

// TODO: use template engine?
func errorBody(statusCode int) string {
	return strings.ReplaceAll(NotFoundPage,
		"%status",
		strconv.Itoa(statusCode)+" "+errorMessage(statusCode))
}