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

com.azure.resourcemanager.billing.models.InvoiceDocument 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.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * The properties of a document.
 */
@Immutable
public final class InvoiceDocument implements JsonSerializable {
    /*
     * The document numbers for the invoice document.
     */
    private List documentNumbers;

    /*
     * The URL to download the invoice document if the source is external to Microsoft.Billing.
     */
    private String externalUrl;

    /*
     * The type of the document.
     */
    private InvoiceDocumentType kind;

    /*
     * The ID that uniquely identifies an invoice document. This ID may be an identifier for an invoice PDF, a credit
     * note, or a tax receipt.
     */
    private String name;

    /*
     * The URL to download the invoice document if the source is internal to Microsoft.Billing.
     */
    private String url;

    /*
     * The source of the document. ENF for Brazil and DRS for rest of the world.
     */
    private DocumentSource source;

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

    /**
     * Get the documentNumbers property: The document numbers for the invoice document.
     * 
     * @return the documentNumbers value.
     */
    public List documentNumbers() {
        return this.documentNumbers;
    }

    /**
     * Get the externalUrl property: The URL to download the invoice document if the source is external to
     * Microsoft.Billing.
     * 
     * @return the externalUrl value.
     */
    public String externalUrl() {
        return this.externalUrl;
    }

    /**
     * Get the kind property: The type of the document.
     * 
     * @return the kind value.
     */
    public InvoiceDocumentType kind() {
        return this.kind;
    }

    /**
     * Get the name property: The ID that uniquely identifies an invoice document. This ID may be an identifier for an
     * invoice PDF, a credit note, or a tax receipt.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the url property: The URL to download the invoice document if the source is internal to Microsoft.Billing.
     * 
     * @return the url value.
     */
    public String url() {
        return this.url;
    }

    /**
     * Get the source property: The source of the document. ENF for Brazil and DRS for rest of the world.
     * 
     * @return the source value.
     */
    public DocumentSource source() {
        return this.source;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

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

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

                if ("documentNumbers".equals(fieldName)) {
                    List documentNumbers = reader.readArray(reader1 -> reader1.getString());
                    deserializedInvoiceDocument.documentNumbers = documentNumbers;
                } else if ("externalUrl".equals(fieldName)) {
                    deserializedInvoiceDocument.externalUrl = reader.getString();
                } else if ("kind".equals(fieldName)) {
                    deserializedInvoiceDocument.kind = InvoiceDocumentType.fromString(reader.getString());
                } else if ("name".equals(fieldName)) {
                    deserializedInvoiceDocument.name = reader.getString();
                } else if ("url".equals(fieldName)) {
                    deserializedInvoiceDocument.url = reader.getString();
                } else if ("source".equals(fieldName)) {
                    deserializedInvoiceDocument.source = DocumentSource.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedInvoiceDocument;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy