class DeviceNotificationSettings {
  String? id;
  String? userId;
  String? thingId;
  DeviceAliasSettings? settings;
  DateTime? updatedAt;

  DeviceNotificationSettings({
    this.id,
    this.userId,
    this.thingId,
    this.settings,
    this.updatedAt,
  });

  DeviceNotificationSettings.fromJson(Map<String, dynamic> json) {
    id = json["id"];
    userId = json["user_id"];
    thingId = json["thing_id"];
    settings = json["settings"] != null
        ? DeviceAliasSettings.fromJson(json["settings"])
        : null;
    updatedAt = DateTime.parse(json["updated_at"]);
  }

  static List<DeviceNotificationSettings> mapToList(
      Map<String, DeviceNotificationSettings> map) {
    return map.values.toList();
  }

  static Map<String, DeviceNotificationSettings> mapFromJson(
      Map<String, dynamic> json) {
    final Map<String, DeviceNotificationSettings> devices = {};
    json.forEach((key, value) {
      devices[key] = DeviceNotificationSettings.fromJson(value);
    });
    return devices;
  }
}

class DeviceAliasSettings {
  String? alias;
  Map<String, int>? notifiSettings;

  DeviceAliasSettings({
    this.alias,
    this.notifiSettings,
  });

  DeviceAliasSettings.fromJson(Map<String, dynamic> json) {
    alias = json['alias'];
    if (json['notifi_settings'] != null) {
      notifiSettings = Map<String, int>.from(json['notifi_settings']);
    }
  }
}
