package gemini

import (
	"strings"
	"testing"

	"github.com/stretchr/testify/require"
)

func TestDefaultModels(t *testing.T) {
	models := DefaultModels()
	
	// Should return 8 models
	require.Len(t, models, 8)
	
	// Each model should have name and methods
	for _, m := range models {
		require.NotEmpty(t, m.Name)
		require.True(t, strings.HasPrefix(m.Name, "models/"))
		require.Contains(t, m.SupportedGenerationMethods, "generateContent")
		require.Contains(t, m.SupportedGenerationMethods, "streamGenerateContent")
	}
}

func TestFallbackModelsList(t *testing.T) {
	resp := FallbackModelsList()
	require.Len(t, resp.Models, 8)
}

func TestFallbackModel(t *testing.T) {
	tests := []struct {
		input    string
		expected string
	}{
		{"", "models/unknown"},
		{"gemini-2.0-flash", "models/gemini-2.0-flash"},
		{"models/gemini-2.5-pro", "models/gemini-2.5-pro"},
		{"custom-model", "models/custom-model"},
	}

	for _, tt := range tests {
		t.Run(tt.input, func(t *testing.T) {
			model := FallbackModel(tt.input)
			require.Equal(t, tt.expected, model.Name)
			require.Contains(t, model.SupportedGenerationMethods, "generateContent")
			require.Contains(t, model.SupportedGenerationMethods, "streamGenerateContent")
		})
	}
}
