# Installer Target Configuration Fragment

[[elements]]
border_bottom = false
border_top = true
name = "target_section_header"
title = "🎯 Installation Target"
type = "section_header"

# Target Type Selection
[[elements]]
default = "local"
help = "Target environment for installation"
name = "target_type"
nickel_path = ["installer", "target", "type"]
options = ["local", "remote", "kubernetes", "docker"]
prompt = "Target Type"
required = true
type = "select"

# Local Installation (conditional)
[[elements]]
condition = "target_type == 'local'"
default = "/opt/provisioning"
help = "Installation directory for local deployment"
name = "local_install_path"
nickel_path = ["installer", "target", "local_path"]
prompt = "Installation Path"
required = true
type = "text"

# Remote Installation (conditional)
[[elements]]
condition = "target_type == 'remote'"
default = "example.com"
help = "Hostname or IP address of remote host"
name = "remote_host"
nickel_path = ["installer", "target", "remote_host"]
prompt = "Remote Host"
required = true
type = "text"

[[elements]]
condition = "target_type == 'remote'"
default = 22
help = "SSH port for remote access (range: ${constraint.common.server.port.min}-${constraint.common.server.port.max})"
max = "${constraint.common.server.port.max}"
min = "${constraint.common.server.port.min}"
name = "remote_ssh_port"
nickel_path = ["installer", "target", "remote_ssh_port"]
prompt = "SSH Port"
type = "number"

[[elements]]
condition = "target_type == 'remote'"
default = "ubuntu"
help = "SSH username for remote access"
name = "remote_ssh_user"
nickel_path = ["installer", "target", "remote_ssh_user"]
prompt = "SSH User"
required = true
type = "text"

[[elements]]
condition = "target_type == 'remote'"
default = ""
help = "Path to SSH private key (leave empty to use ssh-agent)"
name = "remote_ssh_key_path"
nickel_path = ["installer", "target", "remote_ssh_key_path"]
prompt = "SSH Key Path"
type = "text"

[[elements]]
condition = "target_type == 'remote'"
default = false
help = "Accept unknown SSH host keys"
name = "remote_ssh_insecure"
nickel_path = ["installer", "target", "remote_ssh_insecure"]
prompt = "Accept Unknown Keys"
type = "confirm"

# Kubernetes Installation (conditional)
[[elements]]
condition = "target_type == 'kubernetes'"
default = "default"
help = "Kubernetes namespace for installation"
name = "k8s_namespace"
nickel_path = ["installer", "target", "k8s_namespace"]
prompt = "Kubernetes Namespace"
required = true
type = "text"

[[elements]]
condition = "target_type == 'kubernetes'"
default = "provisioning"
help = "Kubernetes context to use"
name = "k8s_context"
nickel_path = ["installer", "target", "k8s_context"]
prompt = "Kubernetes Context"
type = "text"

# Docker Installation (conditional)
[[elements]]
condition = "target_type == 'docker'"
default = "unix:///var/run/docker.sock"
help = "Docker daemon endpoint"
name = "docker_host"
nickel_path = ["installer", "target", "docker_host"]
prompt = "Docker Host"
required = true
type = "text"

# Cloud Provider Configuration (for all types)
[[elements]]
default = "none"
help = "Cloud provider for monitoring and management APIs"
name = "cloud_provider"
nickel_path = ["installer", "target", "cloud_provider"]
options = ["none", "aws", "gcp", "azure", "digitalocean", "linode"]
prompt = "Cloud Provider"
type = "select"

[[elements]]
condition = "cloud_provider != 'none'"
default = ""
help = "Cloud provider region"
name = "cloud_region"
nickel_path = ["installer", "target", "cloud_region"]
prompt = "Cloud Region"
required = true
type = "text"

[[elements]]
condition = "cloud_provider != 'none'"
default = ""
help = "Cloud provider API key or credentials (will be encrypted)"
name = "cloud_credentials"
nickel_path = ["installer", "target", "cloud_credentials"]
prompt = "Cloud Credentials"
type = "password"

# Operating System Detection
[[elements]]
default = "auto"
help = "Target operating system"
name = "target_os"
nickel_path = ["installer", "target", "os"]
options = ["auto", "linux", "macos", "windows"]
prompt = "Target OS"
type = "select"

[[elements]]
condition = "target_os == 'linux'"
default = "auto"
help = "Linux distribution"
name = "target_linux_distro"
nickel_path = ["installer", "target", "linux_distro"]
options = ["auto", "ubuntu", "debian", "centos", "rhel", "alpine"]
prompt = "Linux Distribution"
type = "select"
