# Installer Preflight Checks Configuration Fragment

[[elements]]
border_top = true
border_bottom = false
name = "preflight_section_header"
title = "✅ Preflight Checks"
type = "section_header"

# Disk Space Check
[[elements]]
default = true
help = "Validate sufficient disk space before installation"
name = "check_disk_space"
nickel_path = ["installer", "preflight", "disk_space_check", "enabled"]
prompt = "Check Disk Space"
type = "confirm"

[[elements]]
condition = "check_disk_space == true"
default = 50
help = "Minimum required disk space in GB (range: 1-10000)"
max = 10000
min = 1
name = "min_disk_gb"
nickel_path = ["installer", "preflight", "disk_space_check", "min_disk_gb"]
prompt = "Min Disk Space (GB)"
type = "number"

# Memory Check
[[elements]]
default = true
help = "Validate sufficient RAM before installation"
name = "check_memory"
nickel_path = ["installer", "preflight", "memory_check", "enabled"]
prompt = "Check Memory"
type = "confirm"

[[elements]]
condition = "check_memory == true"
default = 4
help = "Minimum required RAM in GB"
min = 1
max = 512
name = "min_memory_gb"
nickel_path = ["installer", "preflight", "memory_check", "min_memory_gb"]
prompt = "Min Memory (GB)"
type = "number"

# CPU Check
[[elements]]
default = true
help = "Validate minimum CPU cores before installation"
name = "check_cpu"
nickel_path = ["installer", "preflight", "cpu_check", "enabled"]
prompt = "Check CPU Cores"
type = "confirm"

[[elements]]
condition = "check_cpu == true"
default = 2
help = "Minimum required CPU cores"
min = 1
max = 128
name = "min_cpu_cores"
nickel_path = ["installer", "preflight", "cpu_check", "min_cpu_cores"]
prompt = "Min CPU Cores"
type = "number"

# Network Check
[[elements]]
default = true
help = "Validate network connectivity before installation"
name = "check_network"
nickel_path = ["installer", "preflight", "network_check", "enabled"]
prompt = "Check Network Connectivity"
type = "confirm"

[[elements]]
condition = "check_network == true"
default = ""
help = "External host to ping for connectivity test (e.g., 8.8.8.8)"
name = "network_check_host"
nickel_path = ["installer", "preflight", "network_check", "test_host"]
prompt = "Network Test Host"
type = "text"

# Dependency Check
[[elements]]
default = true
help = "Validate required system dependencies are available"
name = "check_dependencies"
nickel_path = ["installer", "preflight", "dependency_check", "enabled"]
prompt = "Check Dependencies"
type = "confirm"

[[elements]]
condition = "check_dependencies == true"
default = true
help = "Check for required container runtime (docker/podman)"
name = "check_container_runtime"
nickel_path = ["installer", "preflight", "dependency_check", "container_runtime"]
prompt = "Check Container Runtime"
type = "confirm"

[[elements]]
condition = "check_dependencies == true"
default = false
help = "Check for Kubernetes cluster connectivity"
name = "check_kubernetes"
nickel_path = ["installer", "preflight", "dependency_check", "kubernetes"]
prompt = "Check Kubernetes"
type = "confirm"

[[elements]]
condition = "check_dependencies == true"
default = false
help = "Check for required Rust toolchain"
name = "check_rust"
nickel_path = ["installer", "preflight", "dependency_check", "rust_toolchain"]
prompt = "Check Rust Toolchain"
type = "confirm"

[[elements]]
condition = "check_dependencies == true"
default = false
help = "Check for Nushell script engine"
name = "check_nushell"
nickel_path = ["installer", "preflight", "dependency_check", "nushell"]
prompt = "Check Nushell"
type = "confirm"

# Port Availability Check
[[elements]]
default = false
help = "Validate that installation ports are available"
name = "check_ports"
nickel_path = ["installer", "preflight", "port_check", "enabled"]
prompt = "Check Port Availability"
type = "confirm"

[[elements]]
condition = "check_ports == true"
default = "9090,8080,8000"
help = "Comma-separated list of ports to check (e.g., 9090,8080,8000)"
name = "ports_to_check"
nickel_path = ["installer", "preflight", "port_check", "ports"]
prompt = "Ports to Check"
type = "text"

# Permissions Check
[[elements]]
default = true
help = "Validate user has necessary permissions for installation"
name = "check_permissions"
nickel_path = ["installer", "preflight", "permissions_check", "enabled"]
prompt = "Check Permissions"
type = "confirm"

[[elements]]
condition = "check_permissions == true"
default = false
help = "Require root/admin permissions for installation"
name = "require_root"
nickel_path = ["installer", "preflight", "permissions_check", "require_root"]
prompt = "Require Root"
type = "confirm"

# File System Check
[[elements]]
default = true
help = "Validate file system compatibility (must support extended attributes)"
name = "check_filesystem"
nickel_path = ["installer", "preflight", "filesystem_check", "enabled"]
prompt = "Check File System"
type = "confirm"

[[elements]]
condition = "check_filesystem == true"
default = false
help = "Require SELinux support"
name = "require_selinux"
nickel_path = ["installer", "preflight", "filesystem_check", "require_selinux"]
prompt = "Require SELinux"
type = "confirm"

# Preflight Check Behavior
[[elements]]
default = false
help = "Skip failed preflight checks and continue installation"
name = "ignore_preflight_failures"
nickel_path = ["installer", "preflight", "ignore_failures"]
prompt = "Ignore Preflight Failures"
type = "confirm"

[[elements]]
default = "warn"
help = "How to handle preflight warnings"
name = "preflight_failure_mode"
nickel_path = ["installer", "preflight", "failure_mode"]
options = ["warn", "error", "fatal"]
prompt = "Failure Mode"
type = "select"
