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.data.entries
17 
18 import android.health.connect.datatypes.ExercisePerformanceGoal
19 import android.health.connect.datatypes.ExerciseRoute
20 import android.health.connect.datatypes.PlannedExerciseBlock
21 import android.health.connect.datatypes.PlannedExerciseStep
22 import com.android.healthconnect.controller.shared.DataType
23 import java.time.Instant
24 
25 sealed class FormattedEntry(open val uuid: String) {
26     data class FormattedDataEntry(
27         override val uuid: String,
28         val header: String,
29         val headerA11y: String,
30         val title: String,
31         val titleA11y: String,
32         val dataType: DataType,
33         val startTime: Instant? = null,
34         val endTime: Instant? = null
35     ) : FormattedEntry(uuid)
36 
37     data class SleepSessionEntry(
38         override val uuid: String,
39         val header: String,
40         val headerA11y: String,
41         val title: String,
42         val titleA11y: String,
43         val dataType: DataType,
44         val notes: String?
45     ) : FormattedEntry(uuid)
46 
47     data class ExerciseSessionEntry(
48         override val uuid: String,
49         val header: String,
50         val headerA11y: String,
51         val title: String,
52         val titleA11y: String,
53         val dataType: DataType,
54         val notes: String?,
55         val route: ExerciseRoute? = null
56     ) : FormattedEntry(uuid)
57 
58     data class SeriesDataEntry(
59         override val uuid: String,
60         val header: String,
61         val headerA11y: String,
62         val title: String,
63         val titleA11y: String,
64         val dataType: DataType
65     ) : FormattedEntry(uuid)
66 
67     data class SessionHeader(val header: String) : FormattedEntry(uuid = "")
68 
69     data class FormattedSectionTitle(val title: String) : FormattedEntry(uuid = "")
70 
71     data class FormattedSectionContent(val title: String, val bulleted: Boolean = false) :
72         FormattedEntry(uuid = "")
73 
74     data class ItemDataEntrySeparator(val title: String = "") : FormattedEntry(uuid = "")
75 
76     data class ReverseSessionDetail(
77         override val uuid: String,
78         val header: String,
79         val headerA11y: String,
80         val title: String,
81         val titleA11y: String,
82     ) : FormattedEntry(uuid)
83 
84     data class FormattedSessionDetail(
85         override val uuid: String,
86         val header: String,
87         val headerA11y: String,
88         val title: String,
89         val titleA11y: String,
90     ) : FormattedEntry(uuid)
91 
92     data class FormattedAggregation(
93         val aggregation: String,
94         val aggregationA11y: String,
95         val contributingApps: String
96     ) : FormattedEntry(aggregation)
97 
98     data class EntryDateSectionHeader(
99         val date: String,
100     ) : FormattedEntry(date)
101 
102     data class PlannedExerciseSessionEntry(
103         override val uuid: String,
104         val header: String,
105         val headerA11y: String,
106         val title: String,
107         val dataType: DataType,
108         val titleA11y: String,
109         val notes: String?
110     ) : FormattedEntry(uuid)
111 
112     data class PlannedExerciseBlockEntry(
113         val block: PlannedExerciseBlock,
114         val title: String,
115         val titleA11y: String
116     ) : FormattedEntry(uuid = "")
117 
118     data class PlannedExerciseStepEntry(
119         val step: PlannedExerciseStep,
120         val title: String,
121         val titleA11y: String
122     ) : FormattedEntry(uuid = "")
123 
124     data class PlannedExerciseSessionNotesEntry(val notes: String) : FormattedEntry(uuid = "")
125 
126     data class ExercisePerformanceGoalEntry(
127         val goal: ExercisePerformanceGoal,
128         val title: String,
129         val titleA11y: String
130     ) : FormattedEntry(uuid = "")
131 }
132