
com.azure.resourcemanager.billing.models.BillingPlanInformation Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.billing.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.LocalDate;
import java.util.List;
import java.util.Objects;
/**
* Information describing the type of billing plan for this savings plan.
*/
@Fluent
public final class BillingPlanInformation implements JsonSerializable {
/*
* Amount of money to be paid for the Order. Tax is not included.
*/
private Price pricingCurrencyTotal;
/*
* Date when the billing plan has started.
*/
private LocalDate startDate;
/*
* For recurring billing plans, indicates the date when next payment will be processed. Null when total is paid off.
*/
private LocalDate nextPaymentDueDate;
/*
* The transactions property.
*/
private List transactions;
/**
* Creates an instance of BillingPlanInformation class.
*/
public BillingPlanInformation() {
}
/**
* Get the pricingCurrencyTotal property: Amount of money to be paid for the Order. Tax is not included.
*
* @return the pricingCurrencyTotal value.
*/
public Price pricingCurrencyTotal() {
return this.pricingCurrencyTotal;
}
/**
* Set the pricingCurrencyTotal property: Amount of money to be paid for the Order. Tax is not included.
*
* @param pricingCurrencyTotal the pricingCurrencyTotal value to set.
* @return the BillingPlanInformation object itself.
*/
public BillingPlanInformation withPricingCurrencyTotal(Price pricingCurrencyTotal) {
this.pricingCurrencyTotal = pricingCurrencyTotal;
return this;
}
/**
* Get the startDate property: Date when the billing plan has started.
*
* @return the startDate value.
*/
public LocalDate startDate() {
return this.startDate;
}
/**
* Set the startDate property: Date when the billing plan has started.
*
* @param startDate the startDate value to set.
* @return the BillingPlanInformation object itself.
*/
public BillingPlanInformation withStartDate(LocalDate startDate) {
this.startDate = startDate;
return this;
}
/**
* Get the nextPaymentDueDate property: For recurring billing plans, indicates the date when next payment will be
* processed. Null when total is paid off.
*
* @return the nextPaymentDueDate value.
*/
public LocalDate nextPaymentDueDate() {
return this.nextPaymentDueDate;
}
/**
* Set the nextPaymentDueDate property: For recurring billing plans, indicates the date when next payment will be
* processed. Null when total is paid off.
*
* @param nextPaymentDueDate the nextPaymentDueDate value to set.
* @return the BillingPlanInformation object itself.
*/
public BillingPlanInformation withNextPaymentDueDate(LocalDate nextPaymentDueDate) {
this.nextPaymentDueDate = nextPaymentDueDate;
return this;
}
/**
* Get the transactions property: The transactions property.
*
* @return the transactions value.
*/
public List transactions() {
return this.transactions;
}
/**
* Set the transactions property: The transactions property.
*
* @param transactions the transactions value to set.
* @return the BillingPlanInformation object itself.
*/
public BillingPlanInformation withTransactions(List transactions) {
this.transactions = transactions;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (pricingCurrencyTotal() != null) {
pricingCurrencyTotal().validate();
}
if (transactions() != null) {
transactions().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("pricingCurrencyTotal", this.pricingCurrencyTotal);
jsonWriter.writeStringField("startDate", Objects.toString(this.startDate, null));
jsonWriter.writeStringField("nextPaymentDueDate", Objects.toString(this.nextPaymentDueDate, null));
jsonWriter.writeArrayField("transactions", this.transactions, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of BillingPlanInformation from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of BillingPlanInformation if the JsonReader was pointing to an instance of it, or null if it
* was pointing to JSON null.
* @throws IOException If an error occurs while reading the BillingPlanInformation.
*/
public static BillingPlanInformation fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
BillingPlanInformation deserializedBillingPlanInformation = new BillingPlanInformation();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("pricingCurrencyTotal".equals(fieldName)) {
deserializedBillingPlanInformation.pricingCurrencyTotal = Price.fromJson(reader);
} else if ("startDate".equals(fieldName)) {
deserializedBillingPlanInformation.startDate
= reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()));
} else if ("nextPaymentDueDate".equals(fieldName)) {
deserializedBillingPlanInformation.nextPaymentDueDate
= reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()));
} else if ("transactions".equals(fieldName)) {
List transactions = reader.readArray(reader1 -> PaymentDetail.fromJson(reader1));
deserializedBillingPlanInformation.transactions = transactions;
} else {
reader.skipChildren();
}
}
return deserializedBillingPlanInformation;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy