package service

import "testing"

func TestNormalizeRoomPinListTypeDoesNotDefaultBlankToRegion(t *testing.T) {
	tests := []struct {
		name    string
		pinType string
		want    string
	}{
		{name: "blank means all pin types", pinType: "", want: ""},
		{name: "space means all pin types", pinType: "   ", want: ""},
		{name: "unknown means all pin types", pinType: "unknown", want: ""},
		{name: "region filter is preserved", pinType: "region", want: roomPinTypeRegion},
		{name: "global filter is preserved", pinType: "global", want: roomPinTypeGlobal},
		{name: "country filter is preserved", pinType: "country", want: roomPinTypeCountry},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := normalizeRoomPinListType(tt.pinType); got != tt.want {
				t.Fatalf("list pin type mismatch: got %q want %q", got, tt.want)
			}
		})
	}
}

func TestNormalizeRoomPinTypeKeepsCreateCompatibility(t *testing.T) {
	if got := normalizeRoomPinType(""); got != roomPinTypeRegion {
		t.Fatalf("blank create pin type must keep legacy region default, got %q", got)
	}
}
