//go:build windows
// +build windows

package process

import "fmt"

// applyResourceLimits is a no-op on Windows as rlimits are Unix-specific.
// Windows uses Job Objects for process limits, which is more complex.
func applyResourceLimits(cfg IsolationConfig) error {
	// Windows doesn't support setrlimit - would need Job Objects
	// For now, log that limits are not enforced on Windows
	if cfg.MaxOpenFiles > 0 || cfg.MaxProcesses > 0 {
		// Process limits not implemented on Windows yet
		// TODO: Use Windows Job Objects for process limits
		return fmt.Errorf("process isolation limits not implemented on Windows (max_open_files=%d, max_processes=%d)",
			cfg.MaxOpenFiles, cfg.MaxProcesses)
	}
	return nil
}

// disableSwap is a no-op on Windows
func disableSwap() error {
	// Windows doesn't support mlockall
	// Would need VirtualLock API
	return nil
}

// GetCurrentLimits returns empty limits on Windows
func GetCurrentLimits() (map[string]uint64, error) {
	limits := make(map[string]uint64)
	getPlatformLimits(limits)
	return limits, nil
}

// getPlatformLimits adds Windows-specific limits (none currently)
func getPlatformLimits(limits map[string]uint64) {
	// Windows doesn't have rlimit equivalent for these
	// Could use GetProcessWorkingSetSize for memory limits
	limits["WINDOWS"] = 1 // Marker to indicate Windows platform
}
