• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  *
7  * ```
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  * ```
10  *
11  * Unless required by applicable law or agreed to in writing, software distributed under the License
12  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13  * or implied. See the License for the specific language governing permissions and limitations under
14  * the License.
15  */
16 package com.android.healthconnect.controller.dataentries
17 
18 import android.health.connect.datatypes.ExerciseRoute
19 import com.android.healthconnect.controller.shared.DataType
20 import java.time.Instant
21 
22 sealed class FormattedEntry(open val uuid: String) {
23     data class FormattedDataEntry(
24         override val uuid: String,
25         val header: String,
26         val headerA11y: String,
27         val title: String,
28         val titleA11y: String,
29         val dataType: DataType,
30         val startTime: Instant? = null,
31         val endTime: Instant? = null
32     ) : FormattedEntry(uuid)
33 
34     data class SleepSessionEntry(
35         override val uuid: String,
36         val header: String,
37         val headerA11y: String,
38         val title: String,
39         val titleA11y: String,
40         val dataType: DataType,
41         val notes: String?
42     ) : FormattedEntry(uuid)
43 
44     data class ExerciseSessionEntry(
45         override val uuid: String,
46         val header: String,
47         val headerA11y: String,
48         val title: String,
49         val titleA11y: String,
50         val dataType: DataType,
51         val notes: String?,
52         val route: ExerciseRoute? = null
53     ) : FormattedEntry(uuid)
54 
55     data class SeriesDataEntry(
56         override val uuid: String,
57         val header: String,
58         val headerA11y: String,
59         val title: String,
60         val titleA11y: String,
61         val dataType: DataType
62     ) : FormattedEntry(uuid)
63 
64     data class SessionHeader(val header: String) : FormattedEntry(uuid = "")
65 
66     data class FormattedSessionDetail(
67         override val uuid: String,
68         val header: String,
69         val headerA11y: String,
70         val title: String,
71         val titleA11y: String,
72     ) : FormattedEntry(uuid)
73 
74     data class FormattedAggregation(
75         val aggregation: String,
76         val aggregationA11y: String,
77         val contributingApps: String
78     ) : FormattedEntry(aggregation)
79 }
80