toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final json = <String, dynamic>{};
  if (deviceId != null) json['device_id'] = deviceId;
  if (alternativeDeviceId != null) {
    json['alternative_device_id'] = alternativeDeviceId;
  }
  if (deviceOperatingSystem != null) {
    json['device_operating_system'] = deviceOperatingSystem;
  }
  if (deviceOperatingSystemVersion != null) {
    json['device_operating_system_version'] = deviceOperatingSystemVersion;
  }
  if (deviceBindingId != null) json['device_binding_id'] = deviceBindingId;
  if (lastBindingDateTime != null) {
    json['last_binding_date_time'] = lastBindingDateTime;
  }
  if (bindingDuration != null) json['binding_duration'] = bindingDuration;
  if (bindingStatus != null) {
    json['binding_status'] = bindingStatus!.value;
  }
  if (deviceType != null) {
    json['device_type'] = deviceType!.value;
  }
  if (deviceManufacturer != null) {
    json['device_manufacturer'] = deviceManufacturer!.toJson();
  }
  if (deviceLanguage != null) json['device_language'] = deviceLanguage;
  if (deviceLocalDateTime != null) {
    json['device_local_date_time'] = deviceLocalDateTime;
  }
  if (connectionType != null) {
    json['connection_type'] = connectionType!.value;
  }
  if (screenInformation != null) {
    json['screen_information'] = screenInformation!.toJson();
  }
  if (batteryStatus != null) json['battery_status'] = batteryStatus!.toJson();
  if (touchSupport != null) json['touch_support'] = touchSupport!.toJson();
  if (motionSensors != null) json['motion_sensors'] = motionSensors!.toJson();
  if (deviceEnvironmentContext != null) {
    json['device_environment_context'] =
        deviceEnvironmentContext!.map((e) => e.value).toList();
  }
  return json;
}