toJson method

Json toJson()

The wire shape.

Implementation

Json toJson() => {
  ...raw,
  'site_id': siteId,
  'name': name,
  'color': color,
  'position': position,
  'locale_default': localeDefault,
  'greeting': greeting,
  'away_message': awayMessage,
  'offline_capture': switch (offlineCapture) {
    OfflineCapture.emailRequired => 'email_required',
    OfflineCapture.emailOptional => 'email_optional',
    OfflineCapture.off => 'off',
  },
  'hide_when_offline': hideWhenOffline,
  'theme': theme.name,
  'bot_enabled': botEnabled,
  'agent_avatars': [for (final a in agentAvatars) a.toJson()],
  'launcher': launcher.toJson(),
  if (header case final h?) 'header': h.toJson(),
  if (greetingOptions case final g?) 'greeting_options': g.toJson(),
  if (contactButtons.isNotEmpty) 'contact_buttons': [for (final c in contactButtons) c.toJson()],
};