package system

import "time"

type JWTSettings struct {
	SigningKey string
	Issuer     string
	Expires    time.Duration
	Buffer     time.Duration
}

type CaptchaSettings struct {
	KeyLong         int
	ImageWidth      int
	ImageHeight     int
	StoreExpiration time.Duration
}

type MediaSettings struct {
	SessionTTL  int
	MaxFileSize int64
	ChunkDir    string
}

const DefaultMaxMediaFileSize int64 = 100 << 20

func (s MediaSettings) EffectiveMaxFileSize() int64 {
	if s.MaxFileSize > 0 {
		return s.MaxFileSize
	}
	return DefaultMaxMediaFileSize
}

// RuntimeSettings exposes only the active values needed by the application.
// The data implementation resolves every call from config.Store so hot reloads
// take effect without rebuilding services.
type RuntimeSettings interface {
	RouterPrefix() string
	JWTSettings() JWTSettings
	CaptchaSettings() CaptchaSettings
	MediaSettings() MediaSettings
	UseMultipoint() bool
}
