Map<String, Object?> toJson() => { 'id': id, 'pattern': pattern.pattern, if (stream != null) 'stream': stream!.name, 'pause': pause, if (once) 'once': true, 'hits': hits, };