# Installer Post-Installation Configuration Fragment

[[elements]]
border_top = true
border_bottom = false
name = "post_install_section_header"
title = "✨ Post-Installation"
type = "section_header"

# Post-Installation Tasks
[[elements]]
default = true
help = "Execute post-installation tasks and configuration"
name = "run_post_install_tasks"
nickel_path = ["installer", "post_install", "enabled"]
prompt = "Run Post-Install Tasks"
type = "confirm"

# Service Configuration
[[elements]]
condition = "run_post_install_tasks == true"
default = true
help = "Configure default admin user and initial policies"
name = "configure_defaults"
nickel_path = ["installer", "post_install", "configure_defaults"]
prompt = "Configure Defaults"
type = "confirm"

[[elements]]
condition = "run_post_install_tasks == true && configure_defaults == true"
default = "admin"
help = "Default admin username"
name = "default_admin_user"
nickel_path = ["installer", "post_install", "default_admin_user"]
prompt = "Default Admin User"
type = "text"

[[elements]]
condition = "run_post_install_tasks == true && configure_defaults == true"
default = ""
help = "Default admin password (leave empty to auto-generate)"
name = "default_admin_password"
nickel_path = ["installer", "post_install", "default_admin_password"]
prompt = "Default Admin Password"
type = "password"

[[elements]]
condition = "run_post_install_tasks == true && configure_defaults == true"
default = ""
help = "Default admin email address"
name = "default_admin_email"
nickel_path = ["installer", "post_install", "default_admin_email"]
prompt = "Default Admin Email"
type = "text"

# Initial Configuration
[[elements]]
condition = "run_post_install_tasks == true"
default = true
help = "Import initial workspace configuration"
name = "import_workspace_config"
nickel_path = ["installer", "post_install", "import_workspace_config"]
prompt = "Import Workspace Config"
type = "confirm"

[[elements]]
condition = "import_workspace_config == true"
default = "/etc/provisioning/workspace-config.yaml"
help = "Path to workspace configuration file"
name = "workspace_config_path"
nickel_path = ["installer", "post_install", "workspace_config_path"]
prompt = "Workspace Config Path"
type = "text"

# Extension Loading
[[elements]]
condition = "run_post_install_tasks == true"
default = false
help = "Load extensions from registry after installation"
name = "load_extensions_post_install"
nickel_path = ["installer", "post_install", "load_extensions"]
prompt = "Load Extensions"
type = "confirm"

[[elements]]
condition = "load_extensions_post_install == true"
default = ""
help = "Comma-separated list of extension names to load"
name = "extensions_to_load"
nickel_path = ["installer", "post_install", "extensions_to_load"]
prompt = "Extensions to Load"
type = "text"

# API Setup
[[elements]]
condition = "run_post_install_tasks == true"
default = false
help = "Configure API tokens and authentication"
name = "setup_api_auth"
nickel_path = ["installer", "post_install", "setup_api_auth"]
prompt = "Setup API Authentication"
type = "confirm"

[[elements]]
condition = "setup_api_auth == true"
default = "jwt"
help = "API authentication method"
name = "api_auth_method"
nickel_path = ["installer", "post_install", "api_auth_method"]
options = ["jwt", "oauth2", "api_key"]
prompt = "API Auth Method"
type = "select"

[[elements]]
condition = "setup_api_auth == true && api_auth_method == 'jwt'"
default = ""
help = "JWT issuer URL"
name = "jwt_issuer"
nickel_path = ["installer", "post_install", "jwt_issuer"]
prompt = "JWT Issuer"
type = "text"

# Verification Tasks
[[elements]]
condition = "run_post_install_tasks == true"
default = true
help = "Run verification tests after installation"
name = "run_verification_tests"
nickel_path = ["installer", "post_install", "verification", "enabled"]
prompt = "Run Verification Tests"
type = "confirm"

[[elements]]
condition = "run_verification_tests == true"
default = 300
help = "Verification test timeout in seconds (range: 30-3600)"
max = 3600
min = 30
name = "verification_timeout"
nickel_path = ["installer", "post_install", "verification", "timeout_seconds"]
prompt = "Verification Timeout (seconds)"
type = "number"

[[elements]]
condition = "run_verification_tests == true"
default = true
help = "Test API connectivity"
name = "test_api_connectivity"
nickel_path = ["installer", "post_install", "verification", "test_api_connectivity"]
prompt = "Test API Connectivity"
type = "confirm"

[[elements]]
condition = "run_verification_tests == true"
default = true
help = "Test database connectivity"
name = "test_database_connectivity"
nickel_path = ["installer", "post_install", "verification", "test_database_connectivity"]
prompt = "Test Database Connectivity"
type = "confirm"

[[elements]]
condition = "run_verification_tests == true"
default = true
help = "Test service health checks"
name = "test_service_health"
nickel_path = ["installer", "post_install", "verification", "test_service_health"]
prompt = "Test Service Health"
type = "confirm"

[[elements]]
condition = "run_verification_tests == true"
default = false
help = "Run performance benchmarks"
name = "run_benchmarks"
nickel_path = ["installer", "post_install", "verification", "run_benchmarks"]
prompt = "Run Benchmarks"
type = "confirm"

# Notification and Reporting
[[elements]]
condition = "run_post_install_tasks == true"
default = false
help = "Send installation completion notification"
name = "send_notification"
nickel_path = ["installer", "post_install", "notification", "enabled"]
prompt = "Send Notification"
type = "confirm"

[[elements]]
condition = "send_notification == true"
default = "email"
help = "Notification method"
name = "notification_method"
nickel_path = ["installer", "post_install", "notification", "method"]
options = ["email", "webhook", "slack", "teams"]
prompt = "Notification Method"
type = "select"

[[elements]]
condition = "send_notification == true && notification_method == 'email'"
default = ""
help = "Email address for completion notification"
name = "notification_email"
nickel_path = ["installer", "post_install", "notification", "email_address"]
prompt = "Notification Email"
type = "text"

[[elements]]
condition = "send_notification == true && notification_method == 'webhook'"
default = ""
help = "Webhook URL for completion notification"
name = "notification_webhook_url"
nickel_path = ["installer", "post_install", "notification", "webhook_url"]
prompt = "Webhook URL"
type = "text"

[[elements]]
condition = "send_notification == true && notification_method == 'slack'"
default = ""
help = "Slack webhook URL"
name = "notification_slack_webhook"
nickel_path = ["installer", "post_install", "notification", "slack_webhook_url"]
prompt = "Slack Webhook URL"
type = "password"

[[elements]]
condition = "send_notification == true && notification_method == 'teams'"
default = ""
help = "Microsoft Teams webhook URL"
name = "notification_teams_webhook"
nickel_path = ["installer", "post_install", "notification", "teams_webhook_url"]
prompt = "Teams Webhook URL"
type = "password"

# Documentation and Access Information
[[elements]]
condition = "run_post_install_tasks == true"
default = true
help = "Generate installation access information and documentation"
name = "generate_access_info"
nickel_path = ["installer", "post_install", "generate_access_info"]
prompt = "Generate Access Info"
type = "confirm"

[[elements]]
condition = "generate_access_info == true"
default = "/var/provisioning/install-info.md"
help = "Path to save installation access information"
name = "access_info_path"
nickel_path = ["installer", "post_install", "access_info_path"]
prompt = "Access Info Path"
type = "text"

[[elements]]
condition = "run_post_install_tasks == true"
default = false
help = "Create compressed archive of installation logs and configs"
name = "create_archive"
nickel_path = ["installer", "post_install", "create_archive"]
prompt = "Create Archive"
type = "confirm"

[[elements]]
condition = "create_archive == true"
default = "/var/backups/provisioning-install-archive.tar.gz"
help = "Path for installation archive"
name = "archive_path"
nickel_path = ["installer", "post_install", "archive_path"]
prompt = "Archive Path"
type = "text"

# Cleanup Tasks
[[elements]]
condition = "run_post_install_tasks == true"
default = true
help = "Clean up temporary installation files"
name = "cleanup_temp_files"
nickel_path = ["installer", "post_install", "cleanup", "remove_temp_files"]
prompt = "Cleanup Temp Files"
type = "confirm"

[[elements]]
condition = "run_post_install_tasks == true"
default = false
help = "Remove installation artifacts (logs, scripts)"
name = "cleanup_artifacts"
nickel_path = ["installer", "post_install", "cleanup", "remove_artifacts"]
prompt = "Cleanup Artifacts"
type = "confirm"

[[elements]]
condition = "run_post_install_tasks == true"
default = false
help = "Run security hardening after installation"
name = "run_security_hardening"
nickel_path = ["installer", "post_install", "security_hardening", "enabled"]
prompt = "Run Security Hardening"
type = "confirm"

[[elements]]
condition = "run_security_hardening == true"
default = true
help = "Disable unnecessary services"
name = "disable_unnecessary_services"
nickel_path = ["installer", "post_install", "security_hardening", "disable_unnecessary_services"]
prompt = "Disable Unnecessary Services"
type = "confirm"

[[elements]]
condition = "run_security_hardening == true"
default = true
help = "Apply security patches"
name = "apply_security_patches"
nickel_path = ["installer", "post_install", "security_hardening", "apply_patches"]
prompt = "Apply Security Patches"
type = "confirm"
