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 import com.google.common.collect.ImmutableList;
23 
24 /**
25  * Download information described in GSMA Service Entitlement Configuration section 6.5.3 table 38.
26  */
27 @AutoValue
28 public abstract class DownloadInfo {
29     /**
30      * The ICCID of the eSIM profile to download from SM-DP+. This is not an empty string when
31      * {@link #profileSmdpAddresses()} is used to trigger the profile download.
32      */
33     @NonNull
profileIccid()34     public abstract String profileIccid();
35 
36     /**
37      * Address(es) of SM-DP+ to obtain eSIM profile. It is an empty list if {@link
38      * #profileActivationCode()} is not empty.
39      */
40     @NonNull
profileSmdpAddresses()41     public abstract ImmutableList<String> profileSmdpAddresses();
42 
43     /**
44      * Activation code as defined in SGP.22 to permit the download of an eSIM profile from an
45      * SM-DP+. It is an empty string if {@link #profileSmdpAddresses()} is not empty.
46      */
47     @NonNull
profileActivationCode()48     public abstract String profileActivationCode();
49 
50     /** Returns builder of {@link DownloadInfo}. */
51     @NonNull
builder()52     public static Builder builder() {
53         return new AutoValue_DownloadInfo.Builder()
54                 .setProfileActivationCode("")
55                 .setProfileSmdpAddresses(ImmutableList.of())
56                 .setProfileIccid("");
57     }
58 
59     /** Builder of DownloadInfo. */
60     @AutoValue.Builder
61     public abstract static class Builder {
62         /**
63          * Set the ICCID of the download profile.
64          *
65          * @param iccid The ICCID of the eSIM profile to download from SM-DP+.
66          * @return The builder.
67          */
68         @NonNull
setProfileIccid(@onNull String iccid)69         public abstract Builder setProfileIccid(@NonNull String iccid);
70 
71         /**
72          * Set the activation code.
73          *
74          * @param activationCode Activation code as defined in SGP.22 to permit the download of an
75          *                       eSIM profile from an SM-DP+.
76          * @return The builder.
77          */
78         @NonNull
setProfileActivationCode(@onNull String activationCode)79         public abstract Builder setProfileActivationCode(@NonNull String activationCode);
80 
81         /**
82          * Set address(es) of SM-DP+ to obtain eSIM profile.
83          *
84          * @param smdpAddress Address(es) of SM-DP+ to obtain eSIM profile.
85          * @return The builder.
86          */
87         @NonNull
setProfileSmdpAddresses(@onNull ImmutableList<String> smdpAddress)88         public abstract Builder setProfileSmdpAddresses(@NonNull ImmutableList<String> smdpAddress);
89 
90         /** Build the DownloadInfo object. */
91         @NonNull
build()92         public abstract DownloadInfo build();
93     }
94 }
95