1 /*
2  * Copyright (C) 2024 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 com.android.adservices.service.stats.kanon;
18 
19 import static com.android.adservices.service.stats.kanon.KAnonSignJoinStatsConstants.KANON_ACTION_FAILURE_REASON_UNSET;
20 import static com.android.adservices.service.stats.kanon.KAnonSignJoinStatsConstants.KANON_ACTION_UNSET;
21 
22 import com.google.auto.value.AutoValue;
23 
24 @AutoValue
25 public abstract class KAnonInitializeStatusStats {
26 
27     /** A boolean representing if the sign call was successful. */
getWasSuccessful()28     public abstract boolean getWasSuccessful();
29 
30     /** The kanon action which caused the failure of the sign call. */
getKAnonAction()31     public abstract int getKAnonAction();
32 
33     /** Cause of the failure, if there was any failure. */
getKAnonActionFailureReason()34     public abstract int getKAnonActionFailureReason();
35 
36     /** The latency of the KAnon sign method in milliseconds. */
getLatencyInMs()37     public abstract int getLatencyInMs();
38 
builder()39     public static Builder builder() {
40         return new AutoValue_KAnonInitializeStatusStats.Builder()
41                 .setKAnonAction(KANON_ACTION_UNSET)
42                 .setKAnonActionFailureReason(KANON_ACTION_FAILURE_REASON_UNSET);
43     }
44 
45     @AutoValue.Builder
46     public abstract static class Builder {
47         /** Sets the wasSuccessful field. */
setWasSuccessful(boolean wasSuccessful)48         public abstract Builder setWasSuccessful(boolean wasSuccessful);
49 
50         /** Sets the batch size. */
setKAnonAction(int kAnonAction)51         public abstract Builder setKAnonAction(int kAnonAction);
52 
53         /** Sets set batch field. */
setKAnonActionFailureReason(int kAnonActionFailureReason)54         public abstract Builder setKAnonActionFailureReason(int kAnonActionFailureReason);
55 
56         /** Sets the latency field. */
setLatencyInMs(int latencyInMs)57         public abstract Builder setLatencyInMs(int latencyInMs);
58 
build()59         public abstract KAnonInitializeStatusStats build();
60     }
61 }
62