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

com.azure.resourcemanager.billing.models.InvoicePropertiesRebillDetails 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.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Rebill details for an invoice.
 */
@Immutable
public final class InvoicePropertiesRebillDetails extends RebillDetails {
    /*
     * The rebill details of an invoice.
     */
    private RebillDetails rebillDetails;

    /*
     * The ID of credit note.
     */
    private String creditNoteDocumentId;

    /*
     * The ID of invoice.
     */
    private String invoiceDocumentId;

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

    /**
     * Get the rebillDetails property: The rebill details of an invoice.
     * 
     * @return the rebillDetails value.
     */
    @Override
    public RebillDetails rebillDetails() {
        return this.rebillDetails;
    }

    /**
     * Get the creditNoteDocumentId property: The ID of credit note.
     * 
     * @return the creditNoteDocumentId value.
     */
    @Override
    public String creditNoteDocumentId() {
        return this.creditNoteDocumentId;
    }

    /**
     * Get the invoiceDocumentId property: The ID of invoice.
     * 
     * @return the invoiceDocumentId value.
     */
    @Override
    public String invoiceDocumentId() {
        return this.invoiceDocumentId;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

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

                if ("invoiceDocumentId".equals(fieldName)) {
                    deserializedInvoicePropertiesRebillDetails.invoiceDocumentId = reader.getString();
                } else if ("creditNoteDocumentId".equals(fieldName)) {
                    deserializedInvoicePropertiesRebillDetails.creditNoteDocumentId = reader.getString();
                } else if ("rebillDetails".equals(fieldName)) {
                    deserializedInvoicePropertiesRebillDetails.rebillDetails = RebillDetails.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedInvoicePropertiesRebillDetails;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy