2023-02-16 01:59:15 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:smoke_cess_app/interface/db_record.dart';
|
|
|
|
|
|
|
|
class Sleep implements DatabaseRecord {
|
|
|
|
final double _sleepQualityValue;
|
|
|
|
final String _comment;
|
|
|
|
final DateTime _date;
|
|
|
|
final TimeOfDay _sleepedAt;
|
|
|
|
final TimeOfDay _wokeUpAt;
|
|
|
|
|
|
|
|
Sleep(this._sleepQualityValue, this._comment, this._date, this._sleepedAt,
|
|
|
|
this._wokeUpAt);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toCSV() {
|
|
|
|
return "${_date.toIso8601String()}, ${_sleepQualityValue.round().toString()}, $_sleepedAt, $_wokeUpAt, $_comment";
|
|
|
|
}
|
2023-02-22 01:28:01 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
Map<String, dynamic> toMap() {
|
|
|
|
return {
|
|
|
|
'sleepQualityValue': _sleepQualityValue,
|
|
|
|
'comment': _comment,
|
|
|
|
'date': _date,
|
|
|
|
'sleepedAt': _sleepedAt,
|
|
|
|
'wokeUpAt': _wokeUpAt,
|
|
|
|
};
|
|
|
|
}
|
2023-02-16 01:59:15 +01:00
|
|
|
}
|