001package com.plivo.api.models.account;
002
003import com.plivo.api.models.base.Deleter;
004import com.plivo.api.util.Utils;
005import okhttp3.ResponseBody;
006import retrofit2.Call;
007
008public class SubaccountDeleter extends Deleter<Subaccount> {
009
010  private Boolean cascade;
011
012  public SubaccountDeleter(String id) {
013    super(id);
014
015    if (!Utils.isSubaccountIdValid(id)) {
016      throw new IllegalArgumentException("invalid subaccount ID");
017    }
018  }
019
020  /**
021   * @return Specify if the subaccount should be cascade deleted or not.
022   */
023  public Boolean cascade() {
024    return this.cascade;
025  }
026
027  /**
028   * @param cascade Specify if the subaccount should be cascade or not.
029   */
030  public SubaccountDeleter cascade(final Boolean cascade) {
031    this.cascade = cascade;
032    return this;
033  }
034
035  @Override
036  protected Call<ResponseBody> obtainCall() {
037    return client().getApiService().subaccountDelete(client().getAuthId(), id, this);
038  }
039}