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

com.azure.resourcemanager.billing.models.RenewPropertiesResponse 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;

/**
 * The renew properties for a reservation.
 */
@Fluent
public final class RenewPropertiesResponse implements JsonSerializable {
    /*
     * The request for reservation purchase
     */
    private ReservationPurchaseRequest purchaseProperties;

    /*
     * Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This
     * is locked price 30 days before expiry.
     */
    private Price pricingCurrencyTotal;

    /*
     * Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not
     * included.
     */
    private Price billingCurrencyTotal;

    /**
     * Creates an instance of RenewPropertiesResponse class.
     */
    public RenewPropertiesResponse() {
    }

    /**
     * Get the purchaseProperties property: The request for reservation purchase.
     * 
     * @return the purchaseProperties value.
     */
    public ReservationPurchaseRequest purchaseProperties() {
        return this.purchaseProperties;
    }

    /**
     * Set the purchaseProperties property: The request for reservation purchase.
     * 
     * @param purchaseProperties the purchaseProperties value to set.
     * @return the RenewPropertiesResponse object itself.
     */
    public RenewPropertiesResponse withPurchaseProperties(ReservationPurchaseRequest purchaseProperties) {
        this.purchaseProperties = purchaseProperties;
        return this;
    }

    /**
     * Get the pricingCurrencyTotal property: Amount that Microsoft uses for record. Used during refund for calculating
     * refund limit. Tax is not included. This is locked price 30 days before expiry.
     * 
     * @return the pricingCurrencyTotal value.
     */
    public Price pricingCurrencyTotal() {
        return this.pricingCurrencyTotal;
    }

    /**
     * Set the pricingCurrencyTotal property: Amount that Microsoft uses for record. Used during refund for calculating
     * refund limit. Tax is not included. This is locked price 30 days before expiry.
     * 
     * @param pricingCurrencyTotal the pricingCurrencyTotal value to set.
     * @return the RenewPropertiesResponse object itself.
     */
    public RenewPropertiesResponse withPricingCurrencyTotal(Price pricingCurrencyTotal) {
        this.pricingCurrencyTotal = pricingCurrencyTotal;
        return this;
    }

    /**
     * Get the billingCurrencyTotal property: Currency and amount that customer will be charged in customer's local
     * currency for renewal purchase. Tax is not included.
     * 
     * @return the billingCurrencyTotal value.
     */
    public Price billingCurrencyTotal() {
        return this.billingCurrencyTotal;
    }

    /**
     * Set the billingCurrencyTotal property: Currency and amount that customer will be charged in customer's local
     * currency for renewal purchase. Tax is not included.
     * 
     * @param billingCurrencyTotal the billingCurrencyTotal value to set.
     * @return the RenewPropertiesResponse object itself.
     */
    public RenewPropertiesResponse withBillingCurrencyTotal(Price billingCurrencyTotal) {
        this.billingCurrencyTotal = billingCurrencyTotal;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (purchaseProperties() != null) {
            purchaseProperties().validate();
        }
        if (pricingCurrencyTotal() != null) {
            pricingCurrencyTotal().validate();
        }
        if (billingCurrencyTotal() != null) {
            billingCurrencyTotal().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("purchaseProperties", this.purchaseProperties);
        jsonWriter.writeJsonField("pricingCurrencyTotal", this.pricingCurrencyTotal);
        jsonWriter.writeJsonField("billingCurrencyTotal", this.billingCurrencyTotal);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of RenewPropertiesResponse from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of RenewPropertiesResponse 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 RenewPropertiesResponse.
     */
    public static RenewPropertiesResponse fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            RenewPropertiesResponse deserializedRenewPropertiesResponse = new RenewPropertiesResponse();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("purchaseProperties".equals(fieldName)) {
                    deserializedRenewPropertiesResponse.purchaseProperties
                        = ReservationPurchaseRequest.fromJson(reader);
                } else if ("pricingCurrencyTotal".equals(fieldName)) {
                    deserializedRenewPropertiesResponse.pricingCurrencyTotal = Price.fromJson(reader);
                } else if ("billingCurrencyTotal".equals(fieldName)) {
                    deserializedRenewPropertiesResponse.billingCurrencyTotal = Price.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRenewPropertiesResponse;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy