description = "Complete example showing RepeatingGroup arrays in action with Nickel schema integration"
display_mode = "complete"
name = "Tracker Configuration with Arrays"

# Header
[[elements]]
border_bottom = true
border_top = true
name = "main_header"
title = "🎯 Tracker & API Configuration"
type = "section_header"

[[elements]]
content = "Configure tracker listeners and API endpoints. You can add multiple UDP/HTTP listeners and manage users and API endpoints dynamically."
name = "intro"
type = "section"

# ========================================================
# TRACKER CONFIGURATION
# ========================================================

[[elements]]
border_top = true
name = "tracker_section_header"
title = "📡 Tracker Configuration"
type = "section_header"

[[elements]]
default = "public"
name = "tracker_mode"
options = [
  { value = "public", label = "Public Tracker (anyone can use)" },
  { value = "private", label = "Private Tracker (registered users only)" },
]
order = 1
prompt = "Tracker Mode"
required = true
type = "select"

# UDP Trackers - Array of listeners
[[elements]]
default_items = 1
fragment = "fragments/tracker-udp-item.toml"
help = "Add UDP tracker listener addresses (must be unique). Standard BitTorrent port is 6969."
max_items = 10
min_items = 0
name = "udp_trackers"
nickel_path = ["udp_trackers"]
order = 2
prompt = "UDP Tracker Listeners"
required = false
type = "repeatinggroup"
unique = true

# HTTP Trackers - Array of listeners
[[elements]]
default_items = 1
fragment = "fragments/tracker-http-item.toml"
help = "Add HTTP tracker listener addresses (must be unique). Standard ports: 80 (HTTP), 443 (HTTPS)"
max_items = 10
min_items = 0
name = "http_trackers"
nickel_path = ["http_trackers"]
order = 3
prompt = "HTTP Tracker Listeners"
required = false
type = "repeatinggroup"
unique = true

# ========================================================
# API CONFIGURATION
# ========================================================

[[elements]]
border_bottom = true
border_top = true
name = "api_section_header"
title = "📡 API Configuration"
type = "section_header"

[[elements]]
help = "Secure token for API authentication and access control"
name = "api_token"
nickel_path = ["api_token"]
order = 4
prompt = "Admin API Token"
required = true
type = "password"

[[elements]]
default = "1212"
help = "Port number for API server (1024-65535). Standard: 1212"
name = "api_port"
nickel_path = ["api_port"]
order = 5
placeholder = "1212"
prompt = "API Port"
required = true
type = "text"

# API Endpoints - Array of exposed endpoints
[[elements]]
default_items = 0
fragment = "fragments/api-endpoint-item.toml"
help = "Define custom API endpoints (must be unique). Each endpoint path must be different."
max_items = 20
min_items = 0
name = "api_endpoints"
nickel_path = ["api_endpoints"]
order = 6
prompt = "API Endpoints"
required = false
type = "repeatinggroup"
unique = true

# ========================================================
# USER MANAGEMENT
# ========================================================

[[elements]]
border_bottom = true
border_top = true
name = "users_section_header"
title = "👥 User Management"
type = "section_header"

[[elements]]
default_items = 0
fragment = "fragments/user-item.toml"
help = "Add user accounts (must be unique). Each username must be different."
max_items = 100
min_items = 0
name = "users"
nickel_path = ["users"]
order = 7
prompt = "User Accounts"
required = false
type = "repeatinggroup"
unique = true

# ========================================================
# OPTIONAL FEATURES
# ========================================================

[[elements]]
border_bottom = true
border_top = true
name = "features_section_header"
title = "⚙️ Optional Features"
type = "section_header"

[[elements]]
default = false
help = "Track performance metrics and statistics"
name = "enable_metrics"
nickel_path = ["enable_metrics"]
order = 8
prompt = "Enable metrics collection"
type = "confirm"

[[elements]]
default = true
help = "Log application events and errors"
name = "enable_logging"
nickel_path = ["enable_logging"]
order = 9
prompt = "Enable logging"
type = "confirm"

[[elements]]
default = "info"
name = "log_level"
nickel_path = ["log_level"]
options = [
  { value = "debug", label = "Debug - All events" },
  { value = "info", label = "Info - Important events" },
  { value = "warn", label = "Warn - Warnings and errors" },
  { value = "error", label = "Error - Errors only" },
]
order = 10
prompt = "Log Level"
type = "select"
when = "enable_logging == true"

# ========================================================
# SUMMARY
# ========================================================

[[elements]]
border_top = true
name = "summary_header"
title = "✅ Configuration Summary"
type = "section_header"

[[elements]]
content = "Review your configuration above. All settings will be validated against the Nickel schema before saving."
name = "summary"
type = "section"
