package api

// AgentForgeConfig holds per-miner settings forged on the Forge page and sent at auth.
type AgentForgeConfig struct {
	Wallet           string
	PoolHost         string
	PoolPort         int
	PoolTLS          bool
	PoolPass         string
	AIEnabled        bool
	AIOllamaEndpoint string
	AIModel          string
	// BackupPools are tried in order if the primary pool is unreachable.
	BackupPools []AgentBackupPool
}

// AgentBackupPool is a fallback pool config received from an agent at auth time.
type AgentBackupPool struct {
	Host string
	Port int
	TLS  bool
	Pass string
}

func (c AgentForgeConfig) poolHostOrDefault(fallback string) string {
	if c.PoolHost != "" {
		return c.PoolHost
	}
	return fallback
}

func (c AgentForgeConfig) poolPortOrDefault(fallback int) int {
	if c.PoolPort > 0 {
		return c.PoolPort
	}
	return fallback
}
