1 /*
2  * Copyright (C) 2021 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;
18 
19 import androidx.annotation.IntDef;
20 import androidx.annotation.NonNull;
21 import androidx.annotation.StringDef;
22 
23 import com.google.auto.value.AutoValue;
24 import com.google.common.collect.ImmutableList;
25 
26 import java.lang.annotation.Retention;
27 import java.lang.annotation.RetentionPolicy;
28 
29 /**
30  * HTTP request parameters specific to on device service activation (ODSA). See GSMA spec TS.43
31  * section 6.2.
32  */
33 @AutoValue
34 public abstract class EsimOdsaOperation {
35     /** ODSA operation unknown. For initialization only. */
36     public static final String OPERATION_UNKNOWN = "";
37 
38     /** ODSA operation: CheckEligibility. */
39     public static final String OPERATION_CHECK_ELIGIBILITY = "CheckEligibility";
40 
41     /** ODSA operation: ManageSubscription. */
42     public static final String OPERATION_MANAGE_SUBSCRIPTION = "ManageSubscription";
43 
44     /** ODSA operation: ManageService. */
45     public static final String OPERATION_MANAGE_SERVICE = "ManageService";
46 
47     /** ODSA operation: AcquireConfiguration. */
48     public static final String OPERATION_ACQUIRE_CONFIGURATION = "AcquireConfiguration";
49 
50     /** ODSA operation: AcquireTemporaryToken. */
51     public static final String OPERATION_ACQUIRE_TEMPORARY_TOKEN = "AcquireTemporaryToken";
52 
53     /** ODSA operation: GetPhoneNumber */
54     public static final String OPERATION_GET_PHONE_NUMBER = "GetPhoneNumber";
55 
56     /** ODSA operation: AcquirePlan */
57     public static final String OPERATION_ACQUIRE_PLAN = "AcquirePlan";
58 
59     @Retention(RetentionPolicy.SOURCE)
60     @StringDef({
61             OPERATION_UNKNOWN,
62             OPERATION_CHECK_ELIGIBILITY,
63             OPERATION_MANAGE_SUBSCRIPTION,
64             OPERATION_MANAGE_SERVICE,
65             OPERATION_ACQUIRE_CONFIGURATION,
66             OPERATION_ACQUIRE_PLAN,
67             OPERATION_ACQUIRE_TEMPORARY_TOKEN,
68             OPERATION_GET_PHONE_NUMBER
69     })
70     public @interface OdsaOperation {
71     }
72 
73     /** eSIM device’s service is unknown. */
74     public static final int SERVICE_STATUS_UNKNOWN = -1;
75 
76     /** eSIM device’s service is activated. */
77     public static final int SERVICE_STATUS_ACTIVATED = 1;
78 
79     /** eSIM device’s service is being activated. */
80     public static final int SERVICE_STATUS_ACTIVATING = 2;
81 
82     /** eSIM device’s service is not activated. */
83     public static final int SERVICE_STATUS_DEACTIVATED = 3;
84 
85     /** eSIM device’s service is not activated and the associated ICCID should not be reused. */
86     public static final int SERVICE_STATUS_DEACTIVATED_NO_REUSE = 4;
87 
88     @Retention(RetentionPolicy.SOURCE)
89     @IntDef({
90             SERVICE_STATUS_UNKNOWN,
91             SERVICE_STATUS_ACTIVATED,
92             SERVICE_STATUS_ACTIVATING,
93             SERVICE_STATUS_DEACTIVATED,
94             SERVICE_STATUS_DEACTIVATED_NO_REUSE
95     })
96     public @interface OdsaServiceStatus {
97     }
98 
99     /** Indicates that operation_type is not set. */
100     public static final int OPERATION_TYPE_NOT_SET = -1;
101 
102     /** To activate a subscription, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}. */
103     public static final int OPERATION_TYPE_SUBSCRIBE = 0;
104 
105     /** To cancel a subscription, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}. */
106     public static final int OPERATION_TYPE_UNSUBSCRIBE = 1;
107 
108     /** To manage an existing subscription, for {@link #OPERATION_MANAGE_SUBSCRIPTION}. */
109     public static final int OPERATION_TYPE_CHANGE_SUBSCRIPTION = 2;
110 
111     /**
112      * To transfer a subscription from an existing device, used by {@link
113      * #OPERATION_MANAGE_SUBSCRIPTION}.
114      */
115     public static final int OPERATION_TYPE_TRANSFER_SUBSCRIPTION = 3;
116 
117     /**
118      * To inform the network of a subscription update, used by
119      * {@link #OPERATION_MANAGE_SUBSCRIPTION}.
120      */
121     public static final int OPERATION_TYPE_UPDATE_SUBSCRIPTION = 4;
122 
123     /** To activate a service, used by {@link #OPERATION_MANAGE_SERVICE}. */
124     public static final int OPERATION_TYPE_ACTIVATE_SERVICE = 10;
125 
126     /** To deactivate a service, used by {@link #OPERATION_MANAGE_SERVICE}. */
127     public static final int OPERATION_TYPE_DEACTIVATE_SERVICE = 11;
128 
129     @Retention(RetentionPolicy.SOURCE)
130     @IntDef({
131             OPERATION_TYPE_NOT_SET,
132             OPERATION_TYPE_SUBSCRIBE,
133             OPERATION_TYPE_UNSUBSCRIBE,
134             OPERATION_TYPE_CHANGE_SUBSCRIPTION,
135             OPERATION_TYPE_TRANSFER_SUBSCRIPTION,
136             OPERATION_TYPE_UPDATE_SUBSCRIPTION,
137             OPERATION_TYPE_ACTIVATE_SERVICE,
138             OPERATION_TYPE_DEACTIVATE_SERVICE
139     })
140     public @interface OdsaOperationType {
141     }
142 
143     /** Operation result unknown. */
144     public static final int OPERATION_RESULT_UNKNOWN = -1;
145 
146     /** Operation was a success. */
147     public static final int OPERATION_RESULT_SUCCESS = 1;
148 
149     /** There was a general error during processing. */
150     public static final int OPERATION_RESULT_ERROR_GENERAL = 100;
151 
152     /** An invalid operation value was provided in request. */
153     public static final int OPERATION_RESULT_ERROR_INVALID_OPERATION = 101;
154 
155     /** An invalid parameter name or value was provided in request. */
156     public static final int OPERATION_RESULT_ERROR_INVALID_PARAMETER = 102;
157 
158     /**
159      * The optional operation is not supported by the carrier. Device should continue with the flow.
160      * This error only applies to optional operations (for example ManageService).
161      */
162     public static final int OPERATION_RESULT_WARNING_NOT_SUPPORTED_OPERATION = 103;
163 
164     /** The user has entered an invalid response for the MSG content. */
165     public static final int OPERATION_RESULT_ERROR_INVALID_MSG_RESPONSE = 104;
166 
167     @Retention(RetentionPolicy.SOURCE)
168     @IntDef({
169             OPERATION_RESULT_UNKNOWN,
170             OPERATION_RESULT_SUCCESS,
171             OPERATION_RESULT_ERROR_GENERAL,
172             OPERATION_RESULT_ERROR_INVALID_OPERATION,
173             OPERATION_RESULT_ERROR_INVALID_PARAMETER,
174             OPERATION_RESULT_WARNING_NOT_SUPPORTED_OPERATION,
175             OPERATION_RESULT_ERROR_INVALID_MSG_RESPONSE
176     })
177     public @interface OdsaOperationResult {
178     }
179 
180     /** Companion service unknown. For initialization only. */
181     public static final String COMPANION_SERVICE_UNKNOWN = "";
182 
183     /** Indicates the companion device carries the same MSISDN as the primary device. */
184     public static final String COMPANION_SERVICE_SHARED_NUMBER = "SharedNumber";
185 
186     /** Indicates the companion device carries a different MSISDN as the primary device. */
187     public static final String COMPANION_SERVICE_DIFFERENT_NUMBER = "DiffNumber";
188 
189     @Retention(RetentionPolicy.SOURCE)
190     @StringDef({
191             COMPANION_SERVICE_UNKNOWN,
192             COMPANION_SERVICE_SHARED_NUMBER,
193             COMPANION_SERVICE_DIFFERENT_NUMBER
194     })
195     public @interface CompanionService {
196     }
197 
198     /** Indicates the MSG content has been rejected by the user. */
199     public static final String MESSAGE_BUTTON_REJECTED = "0";
200 
201     /** Indicates the MSG content has been accepted by the user. */
202     public static final String MESSAGE_BUTTON_ACCEPTED = "1";
203 
204     @Retention(RetentionPolicy.SOURCE)
205     @StringDef({
206             MESSAGE_BUTTON_REJECTED,
207             MESSAGE_BUTTON_ACCEPTED
208     })
209     public @interface MessageButton {
210     }
211 
212     /** Returns the ODSA operation. Used by HTTP parameter {@code operation}. */
operation()213     public abstract String operation();
214 
215     /**
216      * Returns the detailed type of the ODSA operation. Used by HTTP parameter
217      * {@code operation_type}.
218      */
operationType()219     public abstract int operationType();
220 
221     /**
222      * Returns the comma separated list of operation targets used with temporary token from
223      * AcquireTemporaryToken operation. Used by HTTP parameter {@code operation_targets}.
224      */
operationTargets()225     public abstract ImmutableList<String> operationTargets();
226 
227     /**
228      * Returns the unique identifier of the companion device, like IMEI. Used by HTTP parameter
229      * {@code
230      * companion_terminal_id}.
231      */
companionTerminalId()232     public abstract String companionTerminalId();
233 
234     /**
235      * Returns the OEM of the companion device. Used by HTTP parameter {@code
236      * companion_terminal_vendor}.
237      */
companionTerminalVendor()238     public abstract String companionTerminalVendor();
239 
240     /**
241      * Returns the model of the companion device. Used by HTTP parameter {@code
242      * companion_terminal_model}.
243      */
companionTerminalModel()244     public abstract String companionTerminalModel();
245 
246     /**
247      * Returns the software version of the companion device. Used by HTTP parameter {@code
248      * companion_terminal_sw_version}.
249      */
companionTerminalSoftwareVersion()250     public abstract String companionTerminalSoftwareVersion();
251 
252     /**
253      * Returns the user-friendly version of the companion device. Used by HTTP parameter {@code
254      * companion_terminal_friendly_name}.
255      */
companionTerminalFriendlyName()256     public abstract String companionTerminalFriendlyName();
257 
258     /**
259      * Returns the service type of the companion device, e.g. if the MSISDN is same as the primary
260      * device. Used by HTTP parameter {@code companion_terminal_service}.
261      */
companionTerminalService()262     public abstract String companionTerminalService();
263 
264     /**
265      * Returns the ICCID of the companion device. Used by HTTP parameter {@code
266      * companion_terminal_iccid}.
267      */
companionTerminalIccid()268     public abstract String companionTerminalIccid();
269 
270     /**
271      * Returns the EID of the companion device. Used by HTTP parameter
272      * {@code companion_terminal_eid}.
273      */
companionTerminalEid()274     public abstract String companionTerminalEid();
275 
276     /**
277      * Returns the ICCID of the primary device eSIM. Used by HTTP parameter {@code terminal_iccid}.
278      */
terminalIccid()279     public abstract String terminalIccid();
280 
281     /**
282      * Returns the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter {@code
283      * terminal_eid}.
284      */
terminalEid()285     public abstract String terminalEid();
286 
287     /**
288      * Returns the unique identifier of the primary device eSIM, like the IMEI associated with the
289      * eSIM. Used by HTTP parameter {@code target_terminal_id}.
290      */
targetTerminalId()291     public abstract String targetTerminalId();
292 
293     /**
294      * Returns the unique identifiers of the primary device eSIM if more than one, like the IMEIs on
295      * dual-SIM devices. Used by HTTP parameter {@code target_terminal_imeis}.
296      *
297      * <p>This is a non-standard params required by some carriers.
298      */
299     @NonNull
targetTerminalIds()300     public abstract ImmutableList<String> targetTerminalIds();
301 
302     /**
303      * Returns the ICCID primary device eSIM. Used by HTTP parameter {@code target_terminal_iccid}.
304      */
targetTerminalIccid()305     public abstract String targetTerminalIccid();
306 
307     /**
308      * Returns the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter {@code
309      * target_terminal_eid}.
310      */
targetTerminalEid()311     public abstract String targetTerminalEid();
312 
313     /**
314      * Returns the serial number of primary device. Used by HTTP parameter
315      * {@code target_terminal_sn}.
316      *
317      * <p>This is a non-standard params required by some carriers.
318      */
319     @NonNull
targetTerminalSerialNumber()320     public abstract String targetTerminalSerialNumber();
321 
322     /**
323      * Returns the model of primary device. Used by HTTP parameter {@code target_terminal_model}.
324      *
325      * <p>This is a non-standard params required by some carriers.
326      */
327     @NonNull
targetTerminalModel()328     public abstract String targetTerminalModel();
329 
330     /**
331      * Returns the unique identifier of the old device eSIM, like the IMEI associated with the eSIM.
332      * Used by HTTP parameter {@code old_terminal_id}.
333      */
oldTerminalId()334     public abstract String oldTerminalId();
335 
336     /** Returns the ICCID of old device eSIM. Used by HTTP parameter {@code old_terminal_iccid}. */
oldTerminalIccid()337     public abstract String oldTerminalIccid();
338 
339     /**
340      * Returns the user response to the MSG content. Used by HTTP parameter {@code MSG_response}.
341      */
messageResponse()342     public abstract String messageResponse();
343 
344     /**
345      * Returns whether the user has accepted or rejected the MSG content.
346      * Used by HTTP parameter {@code MSG_btn}.
347      */
348     @MessageButton
messageButton()349     public abstract String messageButton();
350 
351     /** Returns a new {@link Builder} object. */
builder()352     public static Builder builder() {
353         return new AutoValue_EsimOdsaOperation.Builder()
354                 .setOperation(OPERATION_UNKNOWN)
355                 .setOperationType(OPERATION_TYPE_NOT_SET)
356                 .setOperationTargets(ImmutableList.of())
357                 .setCompanionTerminalId("")
358                 .setCompanionTerminalVendor("")
359                 .setCompanionTerminalModel("")
360                 .setCompanionTerminalSoftwareVersion("")
361                 .setCompanionTerminalFriendlyName("")
362                 .setCompanionTerminalService(COMPANION_SERVICE_UNKNOWN)
363                 .setCompanionTerminalIccid("")
364                 .setCompanionTerminalEid("")
365                 .setTerminalIccid("")
366                 .setTerminalEid("")
367                 .setTargetTerminalId("")
368                 .setTargetTerminalIds(ImmutableList.of())
369                 .setTargetTerminalIccid("")
370                 .setTargetTerminalEid("")
371                 .setTargetTerminalSerialNumber("")
372                 .setTargetTerminalModel("")
373                 .setOldTerminalId("")
374                 .setOldTerminalIccid("")
375                 .setMessageResponse("")
376                 .setMessageButton("");
377     }
378 
379     /**
380      * Builder.
381      *
382      * <p>For ODSA, the rule of which parameters are required varies or each
383      * operation/operation_type.
384      * The Javadoc below gives high-level description, but please refer to GSMA spec TS.43 section
385      * 6.2
386      * for details.
387      */
388     @AutoValue.Builder
389     public abstract static class Builder {
390         /**
391          * Sets the eSIM ODSA operation. Used by HTTP parameter {@code operation}.
392          *
393          * @param operation ODSA operation.
394          * @return The builder.
395          * @see #OPERATION_CHECK_ELIGIBILITY
396          * @see #OPERATION_MANAGE_SUBSCRIPTION
397          * @see #OPERATION_MANAGE_SERVICE
398          * @see #OPERATION_ACQUIRE_CONFIGURATION
399          * @see #OPERATION_ACQUIRE_TEMPORARY_TOKEN
400          * @see #OPERATION_GET_PHONE_NUMBER
401          * @see #OPERATION_ACQUIRE_PLAN
402          */
403         @NonNull
setOperation(@onNull @dsaOperation String operation)404         public abstract Builder setOperation(@NonNull @OdsaOperation String operation);
405 
406         /**
407          * Sets the detailed type of the eSIM ODSA operation. Used by HTTP parameter
408          * "operation_type" if
409          * set.
410          *
411          * <p>Required by some operation.
412          *
413          * @see #OPERATION_TYPE_SUBSCRIBE
414          * @see #OPERATION_TYPE_UNSUBSCRIBE
415          * @see #OPERATION_TYPE_CHANGE_SUBSCRIPTION
416          * @see #OPERATION_TYPE_TRANSFER_SUBSCRIPTION
417          * @see #OPERATION_TYPE_UPDATE_SUBSCRIPTION
418          * @see #OPERATION_TYPE_ACTIVATE_SERVICE
419          * @see #OPERATION_TYPE_DEACTIVATE_SERVICE
420          */
421         @NonNull
setOperationType(@dsaOperationType int operationType)422         public abstract Builder setOperationType(@OdsaOperationType int operationType);
423 
424         /**
425          * Sets the operation targets to be used with temporary token from AcquireTemporaryToken
426          * operation. Used by HTTP parameter {@code operation_targets} if set.
427          */
428         @NonNull
setOperationTargets( @onNull @dsaOperation ImmutableList<String> operationTargets)429         public abstract Builder setOperationTargets(
430                 @NonNull @OdsaOperation ImmutableList<String> operationTargets);
431 
432         /**
433          * Sets the unique identifier of the companion device, like IMEI. Used by HTTP parameter
434          * {@code
435          * companion_terminal_id} if set.
436          *
437          * <p>Used by companion device ODSA operation.
438          *
439          * @param companionTerminalId The unique identifier of the companion device.
440          * @return The builder.
441          */
442         @NonNull
setCompanionTerminalId(@onNull String companionTerminalId)443         public abstract Builder setCompanionTerminalId(@NonNull String companionTerminalId);
444 
445         /**
446          * Sets the OEM of the companion device. Used by HTTP parameter {@code
447          * companion_terminal_vendor} if set.
448          *
449          * <p>Used by companion device ODSA operation.
450          *
451          * @param companionTerminalVendor The OEM of the companion device.
452          * @return The builder.
453          */
454         @NonNull
setCompanionTerminalVendor(@onNull String companionTerminalVendor)455         public abstract Builder setCompanionTerminalVendor(@NonNull String companionTerminalVendor);
456 
457         /**
458          * Sets the model of the companion device. Used by HTTP parameter {@code
459          * companion_terminal_model} if set.
460          *
461          * <p>Used by companion device ODSA operation.
462          *
463          * @param companionTerminalModel The model of the companion device.
464          * @return The builder.
465          */
466         @NonNull
setCompanionTerminalModel(@onNull String companionTerminalModel)467         public abstract Builder setCompanionTerminalModel(@NonNull String companionTerminalModel);
468 
469         /**
470          * Sets the software version of the companion device. Used by HTTP parameter {@code
471          * companion_terminal_sw_version} if set.
472          *
473          * <p>Used by companion device ODSA operation.
474          *
475          * @param companionTerminalSoftwareVersion The software version of the companion device.
476          * @return The builder.
477          */
478         @NonNull
setCompanionTerminalSoftwareVersion( @onNull String companionTerminalSoftwareVersion)479         public abstract Builder setCompanionTerminalSoftwareVersion(
480                 @NonNull String companionTerminalSoftwareVersion);
481 
482         /**
483          * Sets the user-friendly version of the companion device. Used by HTTP parameter {@code
484          * companion_terminal_friendly_name} if set.
485          *
486          * <p>Used by companion device ODSA operation.
487          *
488          * @param companionTerminalFriendlyName The user-friendly version of the companion device.
489          * @return The builder.
490          */
491         @NonNull
setCompanionTerminalFriendlyName( @onNull String companionTerminalFriendlyName)492         public abstract Builder setCompanionTerminalFriendlyName(
493                 @NonNull String companionTerminalFriendlyName);
494 
495         /**
496          * Sets the service type of the companion device, e.g. if the MSISDN is same as the primary
497          * device. Used by HTTP parameter {@code companion_terminal_service} if set.
498          *
499          * <p>Used by companion device ODSA operation.
500          *
501          * @param companionTerminalService The service type of the companion device.
502          * @return The builder.
503          * @see #COMPANION_SERVICE_SHARED_NUMBER
504          * @see #COMPANION_SERVICE_DIFFERENT_NUMBER
505          */
506         @NonNull
setCompanionTerminalService( @onNull @ompanionService String companionTerminalService)507         public abstract Builder setCompanionTerminalService(
508                 @NonNull @CompanionService String companionTerminalService);
509 
510         /**
511          * Sets the ICCID of the companion device. Used by HTTP parameter {@code
512          * companion_terminal_iccid} if set.
513          *
514          * <p>Used by companion device ODSA operation.
515          *
516          * @param companionTerminalIccid The ICCID of the companion device.
517          * @return The builder.
518          */
519         @NonNull
setCompanionTerminalIccid(@onNull String companionTerminalIccid)520         public abstract Builder setCompanionTerminalIccid(@NonNull String companionTerminalIccid);
521 
522         /**
523          * Sets the eUICC identifier (EID) of the companion device. Used by HTTP parameter {@code
524          * companion_terminal_eid} if set.
525          *
526          * <p>Used by companion device ODSA operation.
527          *
528          * @param companionTerminalEid The eUICC identifier (EID) of the companion device.
529          * @return The builder.
530          */
531         @NonNull
setCompanionTerminalEid(@onNull String companionTerminalEid)532         public abstract Builder setCompanionTerminalEid(@NonNull String companionTerminalEid);
533 
534         /**
535          * Sets the ICCID of the primary device eSIM in case of primary SIM not present. Used by
536          * HTTP
537          * parameter {@code terminal_eid} if set.
538          *
539          * <p>Used by primary device ODSA operation.
540          *
541          * @param terminalIccid The ICCID of the primary device eSIM in case of primary SIM not
542          *                      present.
543          * @return The builder.
544          */
545         @NonNull
setTerminalIccid(@onNull String terminalIccid)546         public abstract Builder setTerminalIccid(@NonNull String terminalIccid);
547 
548         /**
549          * Sets the eUICC identifier (EID) of the primary device eSIM in case of primary SIM not
550          * present. Used by HTTP parameter {@code terminal_eid} if set.
551          *
552          * <p>Used by primary device ODSA operation.
553          *
554          * @param terminalEid The eUICC identifier (EID) of the primary device eSIM in case of
555          *                    primary
556          *                    SIM not present.
557          * @return The builder.
558          */
559         @NonNull
setTerminalEid(@onNull String terminalEid)560         public abstract Builder setTerminalEid(@NonNull String terminalEid);
561 
562         /**
563          * Sets the unique identifier of the primary device eSIM in case of multiple SIM, like the
564          * IMEI
565          * associated with the eSIM. Used by HTTP parameter {@code target_terminal_id} if set.
566          *
567          * <p>Used by primary device ODSA operation.
568          *
569          * @param targetTerminalId The unique identifier of the primary device eSIM in case of
570          *                         multiple
571          *                         SIM.
572          * @return The builder.
573          */
574         @NonNull
setTargetTerminalId(@onNull String targetTerminalId)575         public abstract Builder setTargetTerminalId(@NonNull String targetTerminalId);
576 
577         /**
578          * Sets the unique identifiers of the primary device eSIM if more than one, like the IMEIs
579          * on
580          * dual-SIM devices. Used by HTTP parameter {@code target_terminal_imeis}.
581          *
582          * <p>This is a non-standard params required by some carriers.
583          *
584          * @param targetTerminalIds The unique identifiers of the primary device eSIM if more than
585          *                          one.
586          * @return The builder.
587          */
setTargetTerminalIds( @onNull ImmutableList<String> targetTerminalIds)588         public abstract Builder setTargetTerminalIds(
589                 @NonNull ImmutableList<String> targetTerminalIds);
590 
591         /**
592          * Sets the ICCID primary device eSIM in case of multiple SIM. Used by HTTP parameter {@code
593          * target_terminal_iccid} if set.
594          *
595          * <p>Used by primary device ODSA operation.
596          *
597          * @param targetTerminalIccid The ICCID primary device eSIM in case of multiple SIM.
598          * @return The builder.
599          */
600         @NonNull
setTargetTerminalIccid(@onNull String targetTerminalIccid)601         public abstract Builder setTargetTerminalIccid(@NonNull String targetTerminalIccid);
602 
603         /**
604          * Sets the eUICC identifier (EID) of the primary device eSIM in case of multiple SIM. Used
605          * by
606          * HTTP parameter {@code target_terminal_eid} if set.
607          *
608          * <p>Used by primary device ODSA operation.
609          *
610          * @param terminalEid The eUICC identifier (EID) of the primary device eSIM in case of
611          *                    multiple
612          *                    SIM.
613          * @return The builder.
614          */
615         @NonNull
setTargetTerminalEid(@onNull String terminalEid)616         public abstract Builder setTargetTerminalEid(@NonNull String terminalEid);
617 
618         /**
619          * Sets the serial number of primary device. Used by HTTP parameter
620          * {@code target_terminal_sn}.
621          *
622          * @param targetTerminalSerialNumber The serial number of primary device.
623          *                                   <p>This is a non-standard params required by some
624          *                                   carriers.
625          * @return The builder.
626          */
627         @NonNull
setTargetTerminalSerialNumber( @onNull String targetTerminalSerialNumber)628         public abstract Builder setTargetTerminalSerialNumber(
629                 @NonNull String targetTerminalSerialNumber);
630 
631         /**
632          * Sets the model of primary device. Used by HTTP parameter {@code target_terminal_model}.
633          *
634          * @param targetTerminalModel The model of primary device.
635          *                            <p>This is a non-standard params required by some carriers.
636          * @return The builder.
637          */
638         @NonNull
setTargetTerminalModel(@onNull String targetTerminalModel)639         public abstract Builder setTargetTerminalModel(@NonNull String targetTerminalModel);
640 
641         /**
642          * Sets the unique identifier of the old device eSIM, like the IMEI associated with the
643          * eSIM.
644          * Used by HTTP parameter {@code old_terminal_id} if set.
645          *
646          * <p>Used by primary device ODSA operation.
647          *
648          * @param oldTerminalId The unique identifier of the old device eSIM.
649          * @return The builder.
650          */
651         @NonNull
setOldTerminalId(@onNull String oldTerminalId)652         public abstract Builder setOldTerminalId(@NonNull String oldTerminalId);
653 
654         /**
655          * Sets the ICCID old device eSIM. Used by HTTP parameter {@code old_terminal_iccid} if set.
656          *
657          * <p>Used by primary device ODSA operation.
658          *
659          * @param oldTerminalIccid The ICCID old device eSIM.
660          * @return The builder.
661          */
662         @NonNull
setOldTerminalIccid(@onNull String oldTerminalIccid)663         public abstract Builder setOldTerminalIccid(@NonNull String oldTerminalIccid);
664 
665         /**
666          * Sets the user response to the MSG content. Used by HTTP parameter {@code MSG_response}
667          * if set.
668          *
669          * <p>Used by primary device ODSA operation.
670          *
671          * @param messageResponse The response entered by the user on the device UI.
672          * @return The builder.
673          */
674         @NonNull
setMessageResponse(@onNull String messageResponse)675         public abstract Builder setMessageResponse(@NonNull String messageResponse);
676 
677         /**
678          * Sets whether the user has accepted or rejected the MSG content. Used by HTTP parameter
679          * {@code MSG_btn} if set.
680          *
681          * <p>Used by primary device ODSA operation.
682          *
683          * @param messageButton Whether the user has accepted or rejected the MSG content.
684          * @return The builder.
685          */
686         @NonNull
setMessageButton(@onNull String messageButton)687         public abstract Builder setMessageButton(@NonNull String messageButton);
688 
689         /** Returns the {@link EsimOdsaOperation} object. */
690         @NonNull
build()691         public abstract EsimOdsaOperation build();
692     }
693 }
694