001package com.plivo.api.models.account;
002
003import com.plivo.api.models.base.Creator;
004import com.plivo.api.util.Utils;
005import retrofit2.Call;
006
007public class SubaccountCreator extends Creator<SubaccountCreateResponse> {
008
009  private final String name;
010  private Boolean enabled;
011
012  /**
013   * @param name Name of the subaccount.
014   */
015  SubaccountCreator(String name) {
016    if (!Utils.allNotNull(name)) {
017      throw new IllegalArgumentException("name must not be null");
018    }
019
020    this.name = name;
021  }
022
023  /**
024   * @return Name of the subaccount.
025   */
026  public String name() {
027    return name;
028  }
029
030  /**
031   * @return Specify if the subaccount should be enabled or not. Takes a value of True or False.
032   * Defaults to False
033   */
034  public Boolean enabled() {
035    return this.enabled;
036  }
037
038  /**
039   * @param enabled Specify if the subaccount should be enabled or not. Takes a value of True or
040   * False. Defaults to False
041   */
042  public SubaccountCreator enabled(final Boolean enabled) {
043    this.enabled = enabled;
044    return this;
045  }
046
047  @Override
048  protected Call<SubaccountCreateResponse> obtainCall() {
049    return client().getApiService().subaccountCreate(client().getAuthId(), this);
050  }
051}