package config

import "time"

// ProviderConfig defines an LLM service provider (e.g. deepseek, openai).
type ProviderConfig struct {
	Name         string            `json:"name"`
	BaseURL      string            `json:"base_url"`
	APIKey       string            `json:"api_key"`
	TimeoutSec   int               `json:"timeout_sec"`
	MaxRetries   int               `json:"max_retries"`
	APIVersion   string            `json:"api_version,omitempty"`
	ExtraHeaders map[string]string `json:"extra_headers,omitempty"`
	UpdatedAt    time.Time         `json:"updated_at"`
}

// ModelConfig defines a specific model under a provider.
type ModelConfig struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	Provider    string                 `json:"provider"`
	Description string                 `json:"description"`
	Priority    int                    `json:"priority"`
	Tags        []string               `json:"tags"`
	Params      map[string]interface{} `json:"params"`
	Enabled     bool                   `json:"enabled"`
	UpdatedAt   time.Time              `json:"updated_at"`
}

// RoutingRule maps a purpose to an ordered fallback chain of model IDs.
type RoutingRule struct {
	Purpose       string   `json:"purpose"`
	FallbackChain []string `json:"fallback_chain"`
	Required      bool     `json:"required"`
}

// ModelsConfig is the top-level configuration document.
type ModelsConfig struct {
	Version   string                    `json:"version"`
	Providers map[string]*ProviderConfig `json:"providers"`
	Models    map[string]*ModelConfig    `json:"models"`
	Routing   map[string]*RoutingRule    `json:"routing"`
}
