package litigationplanner

import "testing"

// TestTriggerEventLabelForAppealTarget pins the per-target trigger-
// event label matrix (t-paliad-301 / m/paliad#132 Bug B). The 5
// canonical AppealTargets each have a DE + EN label; unknown targets
// return empty so the caller can fall back to the proceeding's own
// trigger_event_label.
func TestTriggerEventLabelForAppealTarget(t *testing.T) {
	cases := []struct {
		target string
		lang   string
		want   string
	}{
		{AppealTargetEndentscheidung, "de", "Endentscheidung (R.118)"},
		{AppealTargetEndentscheidung, "en", "Final decision (R.118)"},
		{AppealTargetKostenentscheidung, "de", "Kostenentscheidung"},
		{AppealTargetKostenentscheidung, "en", "Cost decision"},
		{AppealTargetAnordnung, "de", "Anordnung"},
		{AppealTargetAnordnung, "en", "Order"},
		{AppealTargetSchadensbemessung, "de", "Entscheidung im Schadensbemessungsverfahren"},
		{AppealTargetSchadensbemessung, "en", "Damages-assessment decision"},
		{AppealTargetBucheinsicht, "de", "Anordnung der Bucheinsicht"},
		{AppealTargetBucheinsicht, "en", "Book-inspection order"},
		// Unknown lang falls through to DE so the caller never gets
		// an empty string for a known target.
		{AppealTargetEndentscheidung, "fr", "Endentscheidung (R.118)"},
		// Unknown target → empty so caller falls back to proceeding's
		// trigger_event_label.
		{"", "de", ""},
		{"foo", "en", ""},
	}
	for _, c := range cases {
		if got := TriggerEventLabelForAppealTarget(c.target, c.lang); got != c.want {
			t.Errorf("TriggerEventLabelForAppealTarget(%q, %q) = %q, want %q",
				c.target, c.lang, got, c.want)
		}
	}
}

// TestAppealTargetsCoverage ensures every entry in AppealTargets has
// a non-empty label in both languages. Adding a target to the slice
// without populating the switch would silently emit empty labels —
// this test catches that.
func TestAppealTargetsCoverage(t *testing.T) {
	for _, target := range AppealTargets {
		for _, lang := range []string{"de", "en"} {
			if got := TriggerEventLabelForAppealTarget(target, lang); got == "" {
				t.Errorf("AppealTarget %q has empty label for lang %q — add it to the switch",
					target, lang)
			}
		}
	}
}
