All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openapitools.client.model.Usage Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
/*
* Quickstart API Reference
* Zuora Quickstart API is the API that helps you achieve fundamental use cases.
* It provides a much simplified object model and improved performance, enabling developers to easily learn and use.
*/

package org.openapitools.client.model;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.client.model.Account;
import org.openapitools.client.model.CustomObject;
import org.openapitools.client.model.ListCustomObjectResponse;
import org.openapitools.client.model.Subscription;
import org.openapitools.client.model.SubscriptionItem;
import org.openapitools.jackson.nullable.JsonNullable;
import org.threeten.bp.OffsetDateTime;

import org.openapitools.client.JSON.CustomFieldAdapter;
import org.openapitools.client.JSON.NullableFieldAdapter;
/**
 * Usage
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Usage {
  public static final String SERIALIZED_NAME_ID = "id";
  @SerializedName(SERIALIZED_NAME_ID)
  private String id;

  public static final String SERIALIZED_NAME_UPDATED_BY_ID = "updated_by_id";
  @SerializedName(SERIALIZED_NAME_UPDATED_BY_ID)
  private String updatedById;

  public static final String SERIALIZED_NAME_UPDATED_TIME = "updated_time";
  @SerializedName(SERIALIZED_NAME_UPDATED_TIME)
  private OffsetDateTime updatedTime;

  public static final String SERIALIZED_NAME_CREATED_BY_ID = "created_by_id";
  @SerializedName(SERIALIZED_NAME_CREATED_BY_ID)
  private String createdById;

  public static final String SERIALIZED_NAME_CREATED_TIME = "created_time";
  @SerializedName(SERIALIZED_NAME_CREATED_TIME)
  private OffsetDateTime createdTime;

  public static final String SERIALIZED_NAME_CUSTOM_FIELDS = "custom_fields";
  @SerializedName(SERIALIZED_NAME_CUSTOM_FIELDS)
  @JsonAdapter(CustomFieldAdapter.class)
  private Map customFields = null;

  public static final String SERIALIZED_NAME_CUSTOM_OBJECTS = "custom_objects";
  @SerializedName(SERIALIZED_NAME_CUSTOM_OBJECTS)
  private Map customObjects = null;

  public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "account_number";
  @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER)
  private String accountNumber;

  public static final String SERIALIZED_NAME_ACCOUNT_ID = "account_id";
  @SerializedName(SERIALIZED_NAME_ACCOUNT_ID)
  private String accountId;

  public static final String SERIALIZED_NAME_SUBSCRIPTION_ITEM_ID = "subscription_item_id";
  @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_ITEM_ID)
  private String subscriptionItemId;

  public static final String SERIALIZED_NAME_SUBSCRIPTION_ITEM_NUMBER = "subscription_item_number";
  @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_ITEM_NUMBER)
  private String subscriptionItemNumber;

  public static final String SERIALIZED_NAME_DESCRIPTION = "description";
  @SerializedName(SERIALIZED_NAME_DESCRIPTION)
  private String description;

  public static final String SERIALIZED_NAME_END_TIME = "end_time";
  @SerializedName(SERIALIZED_NAME_END_TIME)
  private OffsetDateTime endTime;

  public static final String SERIALIZED_NAME_QUANTITY = "quantity";
  @SerializedName(SERIALIZED_NAME_QUANTITY)
  private BigDecimal quantity;

  public static final String SERIALIZED_NAME_START_TIME = "start_time";
  @SerializedName(SERIALIZED_NAME_START_TIME)
  private OffsetDateTime startTime;

  public static final String SERIALIZED_NAME_SUBSCRIPTION_ID = "subscription_id";
  @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_ID)
  private String subscriptionId;

  public static final String SERIALIZED_NAME_SUBSCRIPTION_NUMBER = "subscription_number";
  @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_NUMBER)
  private String subscriptionNumber;

  public static final String SERIALIZED_NAME_UNIT_OF_MEASURE = "unit_of_measure";
  @SerializedName(SERIALIZED_NAME_UNIT_OF_MEASURE)
  private String unitOfMeasure;

  /**
   * Gets or Sets state
   */
  @JsonAdapter(StateEnum.Adapter.class)
  public enum StateEnum {
    PENDING("pending"),
    
    PROCESSED("processed"),
    
    UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

    private String value;

    StateEnum(String value) {
      this.value = value;
    }

    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    public static StateEnum fromValue(String value) {
      for (StateEnum b : StateEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    public static class Adapter extends TypeAdapter {
      @Override
      public void write(final JsonWriter jsonWriter, final StateEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public StateEnum read(final JsonReader jsonReader) throws IOException {
        String value =  jsonReader.nextString();
        return StateEnum.fromValue(value);
      }
    }
  }

  public static final String SERIALIZED_NAME_STATE = "state";
  @SerializedName(SERIALIZED_NAME_STATE)
  private StateEnum state;

  public static final String SERIALIZED_NAME_ACCOUNT = "account";
  @SerializedName(SERIALIZED_NAME_ACCOUNT)
  private Account account;

  public static final String SERIALIZED_NAME_SUBSCRIPTION_ITEM = "subscription_item";
  @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_ITEM)
  private SubscriptionItem subscriptionItem;

  public static final String SERIALIZED_NAME_SUBSCRIPTION = "subscription";
  @SerializedName(SERIALIZED_NAME_SUBSCRIPTION)
  private Subscription subscription;

  public Usage() { 
  }

  
  public Usage(
     String id, 
     String updatedById, 
     OffsetDateTime updatedTime, 
     String createdById, 
     OffsetDateTime createdTime, 
     Map customObjects
  ) {
    this();
    this.id = id;
    this.updatedById = updatedById;
    this.updatedTime = updatedTime;
    this.createdById = createdById;
    this.createdTime = createdTime;
    this.customObjects = customObjects;
  }

   /**
   * Unique identifier for the object.
   * @return id
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Unique identifier for the object.")

  public String getId() {
    return id;
  }




   /**
   * Unique identifier of the Zuora user who last updated the object
   * @return updatedById
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Unique identifier of the Zuora user who last updated the object")

  public String getUpdatedById() {
    return updatedById;
  }




   /**
   * The date and time when the object was last updated in ISO 8601 UTC format.
   * @return updatedTime
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The date and time when the object was last updated in ISO 8601 UTC format.")

  public OffsetDateTime getUpdatedTime() {
    return updatedTime;
  }




   /**
   * Unique identifier of the Zuora user who created the object
   * @return createdById
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Unique identifier of the Zuora user who created the object")

  public String getCreatedById() {
    return createdById;
  }




   /**
   * The date and time when the object was created in ISO 8601 UTC format.
   * @return createdTime
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The date and time when the object was created in ISO 8601 UTC format.")

  public OffsetDateTime getCreatedTime() {
    return createdTime;
  }




  public Usage customFields(Map customFields) {
    
    this.customFields = customFields;
    return this;
  }

  public Usage putCustomFieldsItem(String key, String customFieldsItem) {
    if (this.customFields == null) {
      this.customFields = new HashMap();
    }
    this.customFields.put(key, customFieldsItem);
    return this;
  }

   /**
   * Set of user-defined fields associated with this object. Useful for storing additional information about the object in a structured format.
   * @return customFields
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Set of user-defined fields associated with this object. Useful for storing additional information about the object in a structured format.")

  public Map getCustomFields() {
    return customFields;
  }


  public void setCustomFields(Map customFields) {
    this.customFields = customFields;
  }


   /**
   * The custom objects associated with a Zuora standard object.
   * @return customObjects
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The custom objects associated with a Zuora standard object.")

  public Map getCustomObjects() {
    return customObjects;
  }




  public Usage accountNumber(String accountNumber) {
    
    this.accountNumber = accountNumber;
    return this;
  }

   /**
   * Human-readable identifier of the account. It can be user-supplied. Either `account_number` or `account_id` is required.
   * @return accountNumber
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "A-100001", value = "Human-readable identifier of the account. It can be user-supplied. Either `account_number` or `account_id` is required.")

  public String getAccountNumber() {
    return accountNumber;
  }


  public void setAccountNumber(String accountNumber) {
    this.accountNumber = accountNumber;
  }


  public Usage accountId(String accountId) {
    
    this.accountId = accountId;
    return this;
  }

   /**
   * Identifier of the account associated with this subscription. Either `account_id` or `account_number` is required.
   * @return accountId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Identifier of the account associated with this subscription. Either `account_id` or `account_number` is required.")

  public String getAccountId() {
    return accountId;
  }


  public void setAccountId(String accountId) {
    this.accountId = accountId;
  }


  public Usage subscriptionItemId(String subscriptionItemId) {
    
    this.subscriptionItemId = subscriptionItemId;
    return this;
  }

   /**
   * Identifier of the subscription item.
   * @return subscriptionItemId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Identifier of the subscription item.")

  public String getSubscriptionItemId() {
    return subscriptionItemId;
  }


  public void setSubscriptionItemId(String subscriptionItemId) {
    this.subscriptionItemId = subscriptionItemId;
  }


  public Usage subscriptionItemNumber(String subscriptionItemNumber) {
    
    this.subscriptionItemNumber = subscriptionItemNumber;
    return this;
  }

   /**
   * Human-readable identifier of the subscription item.
   * @return subscriptionItemNumber
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Human-readable identifier of the subscription item.")

  public String getSubscriptionItemNumber() {
    return subscriptionItemNumber;
  }


  public void setSubscriptionItemNumber(String subscriptionItemNumber) {
    this.subscriptionItemNumber = subscriptionItemNumber;
  }


  public Usage description(String description) {
    
    this.description = description;
    return this;
  }

   /**
   * An arbitrary string attached to the object. Often useful for displaying to users.
   * @return description
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "description of test account", value = "An arbitrary string attached to the object. Often useful for displaying to users.")

  public String getDescription() {
    return description;
  }


  public void setDescription(String description) {
    this.description = description;
  }


  public Usage endTime(OffsetDateTime endTime) {
    
    this.endTime = endTime;
    return this;
  }

   /**
   * The end time for which usage is recorded.
   * @return endTime
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The end time for which usage is recorded.")

  public OffsetDateTime getEndTime() {
    return endTime;
  }


  public void setEndTime(OffsetDateTime endTime) {
    this.endTime = endTime;
  }


  public Usage quantity(BigDecimal quantity) {
    
    this.quantity = quantity;
    return this;
  }

   /**
   * The number of units of this item.
   * @return quantity
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The number of units of this item.")

  public BigDecimal getQuantity() {
    return quantity;
  }


  public void setQuantity(BigDecimal quantity) {
    this.quantity = quantity;
  }


  public Usage startTime(OffsetDateTime startTime) {
    
    this.startTime = startTime;
    return this;
  }

   /**
   * The start time for which usage is recorded.
   * @return startTime
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The start time for which usage is recorded.")

  public OffsetDateTime getStartTime() {
    return startTime;
  }


  public void setStartTime(OffsetDateTime startTime) {
    this.startTime = startTime;
  }


  public Usage subscriptionId(String subscriptionId) {
    
    this.subscriptionId = subscriptionId;
    return this;
  }

   /**
   * The identifier of the subscription associated with the billing document item.
   * @return subscriptionId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The identifier of the subscription associated with the billing document item.")

  public String getSubscriptionId() {
    return subscriptionId;
  }


  public void setSubscriptionId(String subscriptionId) {
    this.subscriptionId = subscriptionId;
  }


  public Usage subscriptionNumber(String subscriptionNumber) {
    
    this.subscriptionNumber = subscriptionNumber;
    return this;
  }

   /**
   * Human-readable identifier of the subscription. It can be user-supplied.
   * @return subscriptionNumber
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Human-readable identifier of the subscription. It can be user-supplied.")

  public String getSubscriptionNumber() {
    return subscriptionNumber;
  }


  public void setSubscriptionNumber(String subscriptionNumber) {
    this.subscriptionNumber = subscriptionNumber;
  }


  public Usage unitOfMeasure(String unitOfMeasure) {
    
    this.unitOfMeasure = unitOfMeasure;
    return this;
  }

   /**
   * Specifies the units to measure usage. Units of measure are configured in Zuora Central. Your values depend on your configuration in Billing Settings.
   * @return unitOfMeasure
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Specifies the units to measure usage. Units of measure are configured in Zuora Central. Your values depend on your configuration in Billing Settings.")

  public String getUnitOfMeasure() {
    return unitOfMeasure;
  }


  public void setUnitOfMeasure(String unitOfMeasure) {
    this.unitOfMeasure = unitOfMeasure;
  }


  public Usage state(StateEnum state) {
    
    this.state = state;
    return this;
  }

   /**
   * Get state
   * @return state
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public StateEnum getState() {
    return state;
  }


  public void setState(StateEnum state) {
    this.state = state;
  }


  public Usage account(Account account) {
    
    this.account = account;
    return this;
  }

   /**
   * The account that owns the usages. EXPANDABLE
   * @return account
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The account that owns the usages. EXPANDABLE")

  public Account getAccount() {
    return account;
  }


  public void setAccount(Account account) {
    this.account = account;
  }


  public Usage subscriptionItem(SubscriptionItem subscriptionItem) {
    
    this.subscriptionItem = subscriptionItem;
    return this;
  }

   /**
   * The related subscription item.
   * @return subscriptionItem
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The related subscription item.")

  public SubscriptionItem getSubscriptionItem() {
    return subscriptionItem;
  }


  public void setSubscriptionItem(SubscriptionItem subscriptionItem) {
    this.subscriptionItem = subscriptionItem;
  }


  public Usage subscription(Subscription subscription) {
    
    this.subscription = subscription;
    return this;
  }

   /**
   * The subscription to which this subscription plan belongs.
   * @return subscription
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The subscription to which this subscription plan belongs.")

  public Subscription getSubscription() {
    return subscription;
  }


  public void setSubscription(Subscription subscription) {
    this.subscription = subscription;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Usage usage = (Usage) o;
    return Objects.equals(this.id, usage.id) &&
        Objects.equals(this.updatedById, usage.updatedById) &&
        Objects.equals(this.updatedTime, usage.updatedTime) &&
        Objects.equals(this.createdById, usage.createdById) &&
        Objects.equals(this.createdTime, usage.createdTime) &&
        Objects.equals(this.customFields, usage.customFields) &&
        Objects.equals(this.customObjects, usage.customObjects) &&
        Objects.equals(this.accountNumber, usage.accountNumber) &&
        Objects.equals(this.accountId, usage.accountId) &&
        Objects.equals(this.subscriptionItemId, usage.subscriptionItemId) &&
        Objects.equals(this.subscriptionItemNumber, usage.subscriptionItemNumber) &&
        Objects.equals(this.description, usage.description) &&
        Objects.equals(this.endTime, usage.endTime) &&
        Objects.equals(this.quantity, usage.quantity) &&
        Objects.equals(this.startTime, usage.startTime) &&
        Objects.equals(this.subscriptionId, usage.subscriptionId) &&
        Objects.equals(this.subscriptionNumber, usage.subscriptionNumber) &&
        Objects.equals(this.unitOfMeasure, usage.unitOfMeasure) &&
        Objects.equals(this.state, usage.state) &&
        Objects.equals(this.account, usage.account) &&
        Objects.equals(this.subscriptionItem, usage.subscriptionItem) &&
        Objects.equals(this.subscription, usage.subscription);
  }

  private static  boolean equalsNullable(JsonNullable a, JsonNullable b) {
    return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, updatedById, updatedTime, createdById, createdTime, customFields, customObjects, accountNumber, accountId, subscriptionItemId, subscriptionItemNumber, description, endTime, quantity, startTime, subscriptionId, subscriptionNumber, unitOfMeasure, state, account, subscriptionItem, subscription);
  }

  private static  int hashCodeNullable(JsonNullable a) {
    if (a == null) {
      return 1;
    }
    return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Usage {\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    updatedById: ").append(toIndentedString(updatedById)).append("\n");
    sb.append("    updatedTime: ").append(toIndentedString(updatedTime)).append("\n");
    sb.append("    createdById: ").append(toIndentedString(createdById)).append("\n");
    sb.append("    createdTime: ").append(toIndentedString(createdTime)).append("\n");
    sb.append("    customFields: ").append(toIndentedString(customFields)).append("\n");
    sb.append("    customObjects: ").append(toIndentedString(customObjects)).append("\n");
    sb.append("    accountNumber: ").append(toIndentedString(accountNumber)).append("\n");
    sb.append("    accountId: ").append(toIndentedString(accountId)).append("\n");
    sb.append("    subscriptionItemId: ").append(toIndentedString(subscriptionItemId)).append("\n");
    sb.append("    subscriptionItemNumber: ").append(toIndentedString(subscriptionItemNumber)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    endTime: ").append(toIndentedString(endTime)).append("\n");
    sb.append("    quantity: ").append(toIndentedString(quantity)).append("\n");
    sb.append("    startTime: ").append(toIndentedString(startTime)).append("\n");
    sb.append("    subscriptionId: ").append(toIndentedString(subscriptionId)).append("\n");
    sb.append("    subscriptionNumber: ").append(toIndentedString(subscriptionNumber)).append("\n");
    sb.append("    unitOfMeasure: ").append(toIndentedString(unitOfMeasure)).append("\n");
    sb.append("    state: ").append(toIndentedString(state)).append("\n");
    sb.append("    account: ").append(toIndentedString(account)).append("\n");
    sb.append("    subscriptionItem: ").append(toIndentedString(subscriptionItem)).append("\n");
    sb.append("    subscription: ").append(toIndentedString(subscription)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy