package types

import "github.com/SurgeDM/Surge/internal/config"

// ConvertRuntimeConfig converts the app-level RuntimeConfig to the engine-level RuntimeConfig.
func ConvertRuntimeConfig(rc *config.RuntimeConfig) *RuntimeConfig {
	return &RuntimeConfig{
		MaxConnectionsPerHost: rc.MaxConnectionsPerHost,
		UserAgent:             rc.UserAgent,
		ProxyURL:              rc.ProxyURL,
		CustomDNS:             rc.CustomDNS,
		SequentialDownload:    rc.SequentialDownload,
		MinChunkSize:          rc.MinChunkSize,
		WorkerBufferSize:      rc.WorkerBufferSize,
		MaxTaskRetries:        rc.MaxTaskRetries,
		DialHedgeCount:        rc.DialHedgeCount,
		SlowWorkerThreshold:   rc.SlowWorkerThreshold,
		SlowWorkerGracePeriod: rc.SlowWorkerGracePeriod,
		StallTimeout:          rc.StallTimeout,
		SpeedEmaAlpha:         rc.SpeedEmaAlpha,
	}
}
