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 com.android.libraries.entitlement.odsa;
18 
19 import androidx.annotation.NonNull;
20 
21 import com.google.auto.value.AutoValue;
22 
23 /**
24  * Get phone number operation described in GSMA Service Entitlement Configuration section 6.
25  */
26 public final class GetPhoneNumberOperation {
27     /**
28      * Get phone number request described in GSMA Service Entitlement Configuration section 6.4.8.
29      */
30     @AutoValue
31     public abstract static class GetPhoneNumberRequest {
32         /**
33          * Returns the terminal id.
34          */
35         @NonNull
terminalId()36         public abstract String terminalId();
37 
38         /** Returns a new {@link GetPhoneNumberRequest.Builder} object. */
39         @NonNull
builder()40         public static Builder builder() {
41             return new AutoValue_GetPhoneNumberOperation_GetPhoneNumberRequest
42                 .Builder()
43                 .setTerminalId("");
44         }
45 
46         /** Builder. */
47         @AutoValue.Builder
48         public abstract static class Builder {
49             /**
50              * Sets the terminal id.
51              *
52              * @param terminalId The terminal id.
53              * @return The builder.
54              */
55             @NonNull
setTerminalId(@onNull String terminalId)56             public abstract Builder setTerminalId(@NonNull String terminalId);
57 
58             /** Returns the {@link GetPhoneNumberRequest} object. */
59             @NonNull
build()60             public abstract GetPhoneNumberRequest build();
61         }
62     }
63 
64     /**
65      * Get phone number response described in GSMA Service Entitlement Configuration section
66      * 6.5.8.
67      */
68     @AutoValue
69     public abstract static class GetPhoneNumberResponse extends OdsaResponse {
70 
71         /** The phone number of the subscriber in E.164 format. */
msisdn()72         public abstract String msisdn();
73 
74         /** Returns a new {@link GetPhoneNumberResponse.Builder} object. */
75         @NonNull
builder()76         public static Builder builder() {
77             return new AutoValue_GetPhoneNumberOperation_GetPhoneNumberResponse
78                     .Builder()
79                     .setMsisdn("");
80         }
81 
82         /** Builder. */
83         @AutoValue.Builder
84         public abstract static class Builder extends OdsaResponse.Builder {
85             /**
86              * Sets the phone number of the subscriber.
87              *
88              * @param msisdn The phone number of the subscriber in E.164 format.
89              * @return The builder.
90              */
91             @NonNull
setMsisdn(@onNull String msisdn)92             public abstract Builder setMsisdn(@NonNull String msisdn);
93 
94             /** Returns the {@link GetPhoneNumberResponse} object. */
95             @NonNull
build()96             public abstract GetPhoneNumberResponse build();
97         }
98     }
99 
GetPhoneNumberOperation()100     private GetPhoneNumberOperation() {
101     }
102 }
103