# 048: Checkboxes
# Multiple selections

form newsletter:
  checkbox "Daily digest" -> subscriptions.daily
  checkbox "Weekly roundup" -> subscriptions.weekly
  checkbox "Product updates" -> subscriptions.products
  checkbox "Marketing emails" -> subscriptions.marketing

  button "Subscribe" -> save_subscriptions(subscriptions)

save_subscriptions(subs):
  show "Subscriptions:"
  if subs.daily:
    show "  - Daily digest"
  if subs.weekly:
    show "  - Weekly roundup"
  if subs.products:
    show "  - Product updates"
  if subs.marketing:
    show "  - Marketing emails"

# Checkbox groups
form interests:
  checkbox_group "What interests you?" -> user.interests
    options: ["Technology", "Sports", "Music", "Art", "Travel"]

  button "Save" -> save_interests(user)

save_interests(data):
  show "Interests: {data.interests}"
