description = "Setup account with conditional fields based on user type"
name = "User Account Setup"

# First, select account type
[[elements]]
name = "account_type"
options = [
  { value = "Personal", label = "Personal - Individual use" },
  { value = "Business", label = "Business - Company account" },
  { value = "Developer", label = "Developer - Technical team" },
]
prompt = "What type of account do you want?"
required = true
type = "select"

# Business name is only shown if account_type == Business
[[elements]]
name = "business_name"
placeholder = "Acme Corporation"
prompt = "Enter your business name"
required = true
type = "text"
when = "account_type == Business"

# Business registration is only needed for Business
[[elements]]
name = "business_registration"
placeholder = "123-456-789"
prompt = "Business registration number"
type = "text"
when = "account_type == Business"

# Developer specific fields
[[elements]]
name = "github_username"
prompt = "GitHub username (optional)"
type = "text"
when = "account_type == Developer"

[[elements]]
name = "preferred_language"
options = [
  { value = "Rust", label = "🦀 Rust - Systems programming" },
  { value = "Python", label = "🐍 Python - Data & scripting" },
  { value = "Go", label = "🐹 Go - Cloud native" },
  { value = "Java", label = "☕ Java - Enterprise" },
  { value = "JavaScript", label = "🟨 JavaScript - Web development" },
]
prompt = "Preferred programming language"
type = "select"
when = "account_type == Developer"

# Email (required for all)
[[elements]]
name = "email"
placeholder = "user@example.com"
prompt = "Email address"
required = true
type = "text"

# Enable 2FA
[[elements]]
default = true
name = "enable_2fa"
prompt = "Enable two-factor authentication?"
required = true
type = "confirm"

# 2FA method only if enabled
[[elements]]
name = "2fa_method"
options = [
  { value = "TOTP", label = "🔐 TOTP - Authenticator app" },
  { value = "SMS", label = "📱 SMS - Text message" },
  { value = "Email", label = "📧 Email" },
]
prompt = "Choose 2FA method"
required = true
type = "select"
when = "enable_2fa == true"

# Phone number for SMS 2FA
[[elements]]
name = "phone_number"
placeholder = "+1234567890"
prompt = "Phone number (for SMS 2FA)"
required = true
type = "text"
when = "2fa_method == SMS"

# Newsletter subscription
[[elements]]
default = false
name = "subscribe_newsletter"
prompt = "Subscribe to our newsletter?"
type = "confirm"

# Newsletter frequency (only if subscribed)
[[elements]]
name = "newsletter_frequency"
options = [
  { value = "Weekly", label = "📬 Weekly - Every 7 days" },
  { value = "Monthly", label = "📅 Monthly - Once per month" },
  { value = "Quarterly", label = "📊 Quarterly - Every 3 months" },
]
prompt = "How often would you like to receive newsletters?"
required = true
type = "select"
when = "subscribe_newsletter == true"

# Terms and conditions (always required)
[[elements]]
default = false
name = "agree_terms"
prompt = "I agree to the terms and conditions *"
required = true
type = "confirm"
