package mail

import "testing"

func TestValidatePatchMailSettings(t *testing.T) {
	t.Run("empty body", func(t *testing.T) {
		err := validatePatchMailSettings(&patchMailSettingsRequest{})
		if err == nil {
			t.Fatal("expected validation error")
		}
	})

	t.Run("valid partial patch", func(t *testing.T) {
		density := "compact"
		err := validatePatchMailSettings(&patchMailSettingsRequest{Density: &density})
		if err != nil {
			t.Fatalf("unexpected error: %v", err)
		}
	})

	t.Run("invalid density", func(t *testing.T) {
		density := "huge"
		err := validatePatchMailSettings(&patchMailSettingsRequest{Density: &density})
		if err == nil {
			t.Fatal("expected validation error")
		}
	})

	t.Run("invalid background", func(t *testing.T) {
		bg := "photo-space"
		err := validatePatchMailSettings(&patchMailSettingsRequest{BackgroundID: &bg})
		if err == nil {
			t.Fatal("expected validation error")
		}
	})
}

func TestDefaultMailSettings(t *testing.T) {
	d := defaultMailSettings()
	if d.Density != "default" || d.ThemeMode != "system" || !d.ConversationMode {
		t.Fatalf("defaults = %#v", d)
	}
}
