// Package mistral provides a provider.Adapter for the Mistral AI API.
// Mistral exposes an OpenAI-compatible API — we delegate directly to openai.New.
package mistral

import (
	"github.com/veylant/ia-gateway/internal/provider/openai"
)

// Config holds Mistral AI adapter configuration.
type Config struct {
	APIKey         string
	BaseURL        string // default: https://api.mistral.ai/v1
	TimeoutSeconds int
	MaxConns       int
}

// New creates a Mistral adapter backed by the OpenAI-compatible API.
// Mistral models (mistral-small, mistral-medium, mixtral-*) use the same
// /chat/completions endpoint and request/response format as OpenAI.
func New(cfg Config) *openai.Adapter {
	if cfg.BaseURL == "" {
		cfg.BaseURL = "https://api.mistral.ai/v1"
	}
	return openai.New(openai.Config{
		APIKey:         cfg.APIKey,
		BaseURL:        cfg.BaseURL,
		TimeoutSeconds: cfg.TimeoutSeconds,
		MaxConns:       cfg.MaxConns,
	})
}
