package config

import (
	"os"
	"path/filepath"
	"runtime"
)

// Config holds all KeyHunter runtime configuration.
// Values are populated from ~/.keyhunter.yaml, environment variables, and CLI flags (in that precedence order).
type Config struct {
	DBPath     string // path to SQLite database file
	ConfigPath string // path to config YAML file
	Workers    int    // number of scanner worker goroutines
	Passphrase string // encryption passphrase (sensitive)
}

// Load returns a Config with defaults applied.
// Callers should override individual fields after Load() using viper-bound values.
func Load() Config {
	home, _ := os.UserHomeDir()
	return Config{
		DBPath:     filepath.Join(home, ".keyhunter", "keyhunter.db"),
		ConfigPath: filepath.Join(home, ".keyhunter.yaml"),
		Workers:    runtime.NumCPU() * 8,
		Passphrase: "", // Phase 1: empty passphrase; Phase 6+ will prompt
	}
}
