package litigationplanner

// CourtRegistry maps a court id (e.g. "upc-ld-paris", "de-bgh") to its
// (country, regime) tuple, which drives non-working-day adjustment.
//
// Implementations:
//   - paliad: reads paliad.courts (CourtService.CountryRegime).
//   - embedded/upc (Slice C): in-memory map populated from the embedded
//     JSON snapshot.
//
// Empty courtID falls back to (defaultCountry, defaultRegime) so callers
// without a court_id (the abstract Verfahrensablauf path) still get
// sensible behaviour. Returns an error when courtID is non-empty and
// not in the registry.
type CourtRegistry interface {
	CountryRegime(courtID, defaultCountry, defaultRegime string) (country, regime string, err error)
}

// Country and regime constants — keep in sync with the paliad.countries
// seed list and the holidays_regime_chk / courts_regime_chk constraints.
const (
	CountryDE = "DE"
	RegimeUPC = "UPC"
	RegimeEPO = "EPO"
)

// DefaultsForJurisdiction maps the proceeding-type jurisdiction text
// ('UPC' | 'DE' | 'EPA' | 'DPMA' | nil) to the (country, regime) tuple
// a holiday lookup should default to when the caller didn't pass an
// explicit CourtID. UPC proceedings get DE+UPC (München LD is HLC's
// most common venue, German federal holidays plus UPC vacations apply);
// DE / DPMA / EPA get DE-only (German federal). Future EPA-specific
// closures will require callers to pick an EPA court explicitly so the
// EPO regime kicks in.
//
// Helper kept tiny and stateless — when a caller passes a real CourtID,
// these defaults are bypassed entirely and the court's actual country +
// regime are used.
func DefaultsForJurisdiction(jurisdiction *string) (country, regime string) {
	if jurisdiction == nil {
		return CountryDE, ""
	}
	switch *jurisdiction {
	case "UPC":
		return CountryDE, RegimeUPC
	default:
		return CountryDE, ""
	}
}
