1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.health.connect.datatypes;
18 
19 import android.annotation.IntDef;
20 
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 import java.util.Set;
24 
25 /** Identifier for the meal type. */
26 public final class MealType {
27     public static final int MEAL_TYPE_UNKNOWN = 0;
28 
29     /** Use this for the first meal of the day, usually the morning meal. */
30     public static final int MEAL_TYPE_BREAKFAST = 1;
31 
32     /** Use this for the noon meal. */
33     public static final int MEAL_TYPE_LUNCH = 2;
34 
35     /** Use this for last meal of the day, usually the evening meal. */
36     public static final int MEAL_TYPE_DINNER = 3;
37 
38     /** Any meal outside of the usual three meals per day. */
39     public static final int MEAL_TYPE_SNACK = 4;
40 
41     /**
42      * Valid set of values for this IntDef. Update this set when add new type or deprecate existing
43      * type.
44      *
45      * @hide
46      */
47     public static final Set<Integer> VALID_TYPES =
48             Set.of(
49                     MEAL_TYPE_UNKNOWN,
50                     MEAL_TYPE_BREAKFAST,
51                     MEAL_TYPE_LUNCH,
52                     MEAL_TYPE_DINNER,
53                     MEAL_TYPE_SNACK);
54 
MealType()55     private MealType() {}
56 
57     /** @hide */
58     @IntDef({
59         MEAL_TYPE_UNKNOWN,
60         MEAL_TYPE_BREAKFAST,
61         MEAL_TYPE_LUNCH,
62         MEAL_TYPE_DINNER,
63         MEAL_TYPE_SNACK
64     })
65     @Retention(RetentionPolicy.SOURCE)
66     public @interface MealTypes {}
67 }
68