package config

import (
	"time"

	"github.com/tidbcloud/aisupport/packages/sdk-go/infra/config"
)

type ClientsConfig struct {
	Jira         config.JiraClient  `yaml:"jira"`
	Lark         config.LarkClient  `yaml:"lark"`
	AgentGateway AgentGatewayConfig `yaml:"agentGateway"`
	Core         CoreConfig         `yaml:"core"`
	DevOps       DevOpsConfig       `yaml:"devops"`
	Oncall       OncallConfig       `yaml:"oncall"`
}

type AgentGatewayConfig struct {
	Address string        `yaml:"address" default:"agent-gateway:9090" validate:"required"`
	Timeout time.Duration `yaml:"timeout" default:"5s" validate:"gt=0"`
}

type CoreConfig struct {
	Addr string `yaml:"addr" default:"127.0.0.1:9090"`
}

type OncallConfig struct {
	Addr    string        `yaml:"addr" validate:"required"`
	APIKey  string        `yaml:"apiKey" validate:"required"`
	Timeout time.Duration `yaml:"timeout" default:"5s" validate:"gt=0"`
	Debug   bool          `yaml:"debug" default:"true"`
}

// DevOpsConfig configures the timeline evidence collector.
type DevOpsConfig struct {
	APIToken    string        `yaml:"apiToken"` // READ FROM ASM in production
	BaseURL     string        `yaml:"baseUrl" default:"https://prod.devops.pingcap.com"`
	FrontendURL string        `yaml:"frontendUrl" default:"https://ops.tidbcloud.com"`
	Timeout     time.Duration `yaml:"timeout" default:"30s"`
}
