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

com.azure.resourcemanager.billing.models.BillingProfileProperties 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.util.List;
import java.util.Map;

/**
 * A billing profile.
 */
@Fluent
public final class BillingProfileProperties implements JsonSerializable {
    /*
     * The provisioning state of the resource during a long-running operation.
     */
    private ProvisioningState provisioningState;

    /*
     * Identifies the billing relationship represented by the billing profile. The billing relationship may be between
     * Microsoft, the customer, and/or a third-party.
     */
    private BillingRelationshipType billingRelationshipType;

    /*
     * Billing address.
     */
    private BillingProfilePropertiesBillTo billTo;

    /*
     * The currency in which the charges for the billing profile are billed.
     */
    private String currency;

    /*
     * The name of the billing profile.
     */
    private String displayName;

    /*
     * Information about the enabled azure plans.
     */
    private List enabledAzurePlans;

    /*
     * Indicates whether user has read access to the billing profile.
     */
    private Boolean hasReadAccess;

    /*
     * Identifies the billing profile that is linked to another billing profile in indirect purchase motion.
     */
    private BillingProfilePropertiesIndirectRelationshipInfo indirectRelationshipInfo;

    /*
     * The day of the month when the invoice for the billing profile is generated.
     */
    private Integer invoiceDay;

    /*
     * Flag controlling whether the invoices for the billing profile are sent through email.
     */
    private Boolean invoiceEmailOptIn;

    /*
     * The list of email addresses to receive invoices by email for the billing profile.
     */
    private List invoiceRecipients;

    /*
     * The default purchase order number that will appear on the invoices generated for the billing profile.
     */
    private String poNumber;

    /*
     * The default address where the products are shipped, or the services are being used. If a ship to is not specified
     * for a product or a subscription, then this address will be used.
     */
    private BillingProfilePropertiesShipTo shipTo;

    /*
     * The address of the individual or organization that is responsible for the billing account.
     */
    private BillingProfilePropertiesSoldTo soldTo;

    /*
     * The billing profile spending limit.
     */
    private SpendingLimit spendingLimit;

    /*
     * The details of billing profile spending limit.
     */
    private List spendingLimitDetails;

    /*
     * The status of the billing profile.
     */
    private BillingProfileStatus status;

    /*
     * Reason for the specified billing profile status.
     */
    private BillingProfileStatusReasonCode statusReasonCode;

    /*
     * The system generated unique identifier for a billing profile.
     */
    private String systemId;

    /*
     * Dictionary of metadata associated with the resource. Maximum key/value length supported of 256 characters.
     * Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /
     */
    private Map tags;

    /*
     * Identifies the cloud environments that are associated with a billing profile. This is a system managed optional
     * field and gets updated as the billing profile gets associated with accounts in various clouds.
     */
    private List targetClouds;

    /*
     * The current payment term of the billing profile.
     */
    private BillingProfilePropertiesCurrentPaymentTerm currentPaymentTerm;

    /*
     * The other payment terms of the billing profile.
     */
    private List otherPaymentTerms;

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

    /**
     * Get the provisioningState property: The provisioning state of the resource during a long-running operation.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the billingRelationshipType property: Identifies the billing relationship represented by the billing profile.
     * The billing relationship may be between Microsoft, the customer, and/or a third-party.
     * 
     * @return the billingRelationshipType value.
     */
    public BillingRelationshipType billingRelationshipType() {
        return this.billingRelationshipType;
    }

    /**
     * Get the billTo property: Billing address.
     * 
     * @return the billTo value.
     */
    public BillingProfilePropertiesBillTo billTo() {
        return this.billTo;
    }

    /**
     * Set the billTo property: Billing address.
     * 
     * @param billTo the billTo value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withBillTo(BillingProfilePropertiesBillTo billTo) {
        this.billTo = billTo;
        return this;
    }

    /**
     * Get the currency property: The currency in which the charges for the billing profile are billed.
     * 
     * @return the currency value.
     */
    public String currency() {
        return this.currency;
    }

    /**
     * Get the displayName property: The name of the billing profile.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: The name of the billing profile.
     * 
     * @param displayName the displayName value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the enabledAzurePlans property: Information about the enabled azure plans.
     * 
     * @return the enabledAzurePlans value.
     */
    public List enabledAzurePlans() {
        return this.enabledAzurePlans;
    }

    /**
     * Set the enabledAzurePlans property: Information about the enabled azure plans.
     * 
     * @param enabledAzurePlans the enabledAzurePlans value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withEnabledAzurePlans(List enabledAzurePlans) {
        this.enabledAzurePlans = enabledAzurePlans;
        return this;
    }

    /**
     * Get the hasReadAccess property: Indicates whether user has read access to the billing profile.
     * 
     * @return the hasReadAccess value.
     */
    public Boolean hasReadAccess() {
        return this.hasReadAccess;
    }

    /**
     * Get the indirectRelationshipInfo property: Identifies the billing profile that is linked to another billing
     * profile in indirect purchase motion.
     * 
     * @return the indirectRelationshipInfo value.
     */
    public BillingProfilePropertiesIndirectRelationshipInfo indirectRelationshipInfo() {
        return this.indirectRelationshipInfo;
    }

    /**
     * Set the indirectRelationshipInfo property: Identifies the billing profile that is linked to another billing
     * profile in indirect purchase motion.
     * 
     * @param indirectRelationshipInfo the indirectRelationshipInfo value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties
        withIndirectRelationshipInfo(BillingProfilePropertiesIndirectRelationshipInfo indirectRelationshipInfo) {
        this.indirectRelationshipInfo = indirectRelationshipInfo;
        return this;
    }

    /**
     * Get the invoiceDay property: The day of the month when the invoice for the billing profile is generated.
     * 
     * @return the invoiceDay value.
     */
    public Integer invoiceDay() {
        return this.invoiceDay;
    }

    /**
     * Get the invoiceEmailOptIn property: Flag controlling whether the invoices for the billing profile are sent
     * through email.
     * 
     * @return the invoiceEmailOptIn value.
     */
    public Boolean invoiceEmailOptIn() {
        return this.invoiceEmailOptIn;
    }

    /**
     * Set the invoiceEmailOptIn property: Flag controlling whether the invoices for the billing profile are sent
     * through email.
     * 
     * @param invoiceEmailOptIn the invoiceEmailOptIn value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withInvoiceEmailOptIn(Boolean invoiceEmailOptIn) {
        this.invoiceEmailOptIn = invoiceEmailOptIn;
        return this;
    }

    /**
     * Get the invoiceRecipients property: The list of email addresses to receive invoices by email for the billing
     * profile.
     * 
     * @return the invoiceRecipients value.
     */
    public List invoiceRecipients() {
        return this.invoiceRecipients;
    }

    /**
     * Set the invoiceRecipients property: The list of email addresses to receive invoices by email for the billing
     * profile.
     * 
     * @param invoiceRecipients the invoiceRecipients value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withInvoiceRecipients(List invoiceRecipients) {
        this.invoiceRecipients = invoiceRecipients;
        return this;
    }

    /**
     * Get the poNumber property: The default purchase order number that will appear on the invoices generated for the
     * billing profile.
     * 
     * @return the poNumber value.
     */
    public String poNumber() {
        return this.poNumber;
    }

    /**
     * Set the poNumber property: The default purchase order number that will appear on the invoices generated for the
     * billing profile.
     * 
     * @param poNumber the poNumber value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withPoNumber(String poNumber) {
        this.poNumber = poNumber;
        return this;
    }

    /**
     * Get the shipTo property: The default address where the products are shipped, or the services are being used. If a
     * ship to is not specified for a product or a subscription, then this address will be used.
     * 
     * @return the shipTo value.
     */
    public BillingProfilePropertiesShipTo shipTo() {
        return this.shipTo;
    }

    /**
     * Set the shipTo property: The default address where the products are shipped, or the services are being used. If a
     * ship to is not specified for a product or a subscription, then this address will be used.
     * 
     * @param shipTo the shipTo value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withShipTo(BillingProfilePropertiesShipTo shipTo) {
        this.shipTo = shipTo;
        return this;
    }

    /**
     * Get the soldTo property: The address of the individual or organization that is responsible for the billing
     * account.
     * 
     * @return the soldTo value.
     */
    public BillingProfilePropertiesSoldTo soldTo() {
        return this.soldTo;
    }

    /**
     * Set the soldTo property: The address of the individual or organization that is responsible for the billing
     * account.
     * 
     * @param soldTo the soldTo value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withSoldTo(BillingProfilePropertiesSoldTo soldTo) {
        this.soldTo = soldTo;
        return this;
    }

    /**
     * Get the spendingLimit property: The billing profile spending limit.
     * 
     * @return the spendingLimit value.
     */
    public SpendingLimit spendingLimit() {
        return this.spendingLimit;
    }

    /**
     * Get the spendingLimitDetails property: The details of billing profile spending limit.
     * 
     * @return the spendingLimitDetails value.
     */
    public List spendingLimitDetails() {
        return this.spendingLimitDetails;
    }

    /**
     * Get the status property: The status of the billing profile.
     * 
     * @return the status value.
     */
    public BillingProfileStatus status() {
        return this.status;
    }

    /**
     * Get the statusReasonCode property: Reason for the specified billing profile status.
     * 
     * @return the statusReasonCode value.
     */
    public BillingProfileStatusReasonCode statusReasonCode() {
        return this.statusReasonCode;
    }

    /**
     * Get the systemId property: The system generated unique identifier for a billing profile.
     * 
     * @return the systemId value.
     */
    public String systemId() {
        return this.systemId;
    }

    /**
     * Get the tags property: Dictionary of metadata associated with the resource. Maximum key/value length supported of
     * 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /.
     * 
     * @return the tags value.
     */
    public Map tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Dictionary of metadata associated with the resource. Maximum key/value length supported of
     * 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /.
     * 
     * @param tags the tags value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the targetClouds property: Identifies the cloud environments that are associated with a billing profile. This
     * is a system managed optional field and gets updated as the billing profile gets associated with accounts in
     * various clouds.
     * 
     * @return the targetClouds value.
     */
    public List targetClouds() {
        return this.targetClouds;
    }

    /**
     * Get the currentPaymentTerm property: The current payment term of the billing profile.
     * 
     * @return the currentPaymentTerm value.
     */
    public BillingProfilePropertiesCurrentPaymentTerm currentPaymentTerm() {
        return this.currentPaymentTerm;
    }

    /**
     * Set the currentPaymentTerm property: The current payment term of the billing profile.
     * 
     * @param currentPaymentTerm the currentPaymentTerm value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties
        withCurrentPaymentTerm(BillingProfilePropertiesCurrentPaymentTerm currentPaymentTerm) {
        this.currentPaymentTerm = currentPaymentTerm;
        return this;
    }

    /**
     * Get the otherPaymentTerms property: The other payment terms of the billing profile.
     * 
     * @return the otherPaymentTerms value.
     */
    public List otherPaymentTerms() {
        return this.otherPaymentTerms;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (billTo() != null) {
            billTo().validate();
        }
        if (enabledAzurePlans() != null) {
            enabledAzurePlans().forEach(e -> e.validate());
        }
        if (indirectRelationshipInfo() != null) {
            indirectRelationshipInfo().validate();
        }
        if (shipTo() != null) {
            shipTo().validate();
        }
        if (soldTo() != null) {
            soldTo().validate();
        }
        if (spendingLimitDetails() != null) {
            spendingLimitDetails().forEach(e -> e.validate());
        }
        if (currentPaymentTerm() != null) {
            currentPaymentTerm().validate();
        }
        if (otherPaymentTerms() != null) {
            otherPaymentTerms().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("billTo", this.billTo);
        jsonWriter.writeStringField("displayName", this.displayName);
        jsonWriter.writeArrayField("enabledAzurePlans", this.enabledAzurePlans,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeJsonField("indirectRelationshipInfo", this.indirectRelationshipInfo);
        jsonWriter.writeBooleanField("invoiceEmailOptIn", this.invoiceEmailOptIn);
        jsonWriter.writeArrayField("invoiceRecipients", this.invoiceRecipients,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("poNumber", this.poNumber);
        jsonWriter.writeJsonField("shipTo", this.shipTo);
        jsonWriter.writeJsonField("soldTo", this.soldTo);
        jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("currentPaymentTerm", this.currentPaymentTerm);
        return jsonWriter.writeEndObject();
    }

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

                if ("provisioningState".equals(fieldName)) {
                    deserializedBillingProfileProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("billingRelationshipType".equals(fieldName)) {
                    deserializedBillingProfileProperties.billingRelationshipType
                        = BillingRelationshipType.fromString(reader.getString());
                } else if ("billTo".equals(fieldName)) {
                    deserializedBillingProfileProperties.billTo = BillingProfilePropertiesBillTo.fromJson(reader);
                } else if ("currency".equals(fieldName)) {
                    deserializedBillingProfileProperties.currency = reader.getString();
                } else if ("displayName".equals(fieldName)) {
                    deserializedBillingProfileProperties.displayName = reader.getString();
                } else if ("enabledAzurePlans".equals(fieldName)) {
                    List enabledAzurePlans = reader.readArray(reader1 -> AzurePlan.fromJson(reader1));
                    deserializedBillingProfileProperties.enabledAzurePlans = enabledAzurePlans;
                } else if ("hasReadAccess".equals(fieldName)) {
                    deserializedBillingProfileProperties.hasReadAccess = reader.getNullable(JsonReader::getBoolean);
                } else if ("indirectRelationshipInfo".equals(fieldName)) {
                    deserializedBillingProfileProperties.indirectRelationshipInfo
                        = BillingProfilePropertiesIndirectRelationshipInfo.fromJson(reader);
                } else if ("invoiceDay".equals(fieldName)) {
                    deserializedBillingProfileProperties.invoiceDay = reader.getNullable(JsonReader::getInt);
                } else if ("invoiceEmailOptIn".equals(fieldName)) {
                    deserializedBillingProfileProperties.invoiceEmailOptIn = reader.getNullable(JsonReader::getBoolean);
                } else if ("invoiceRecipients".equals(fieldName)) {
                    List invoiceRecipients = reader.readArray(reader1 -> reader1.getString());
                    deserializedBillingProfileProperties.invoiceRecipients = invoiceRecipients;
                } else if ("poNumber".equals(fieldName)) {
                    deserializedBillingProfileProperties.poNumber = reader.getString();
                } else if ("shipTo".equals(fieldName)) {
                    deserializedBillingProfileProperties.shipTo = BillingProfilePropertiesShipTo.fromJson(reader);
                } else if ("soldTo".equals(fieldName)) {
                    deserializedBillingProfileProperties.soldTo = BillingProfilePropertiesSoldTo.fromJson(reader);
                } else if ("spendingLimit".equals(fieldName)) {
                    deserializedBillingProfileProperties.spendingLimit = SpendingLimit.fromString(reader.getString());
                } else if ("spendingLimitDetails".equals(fieldName)) {
                    List spendingLimitDetails
                        = reader.readArray(reader1 -> SpendingLimitDetails.fromJson(reader1));
                    deserializedBillingProfileProperties.spendingLimitDetails = spendingLimitDetails;
                } else if ("status".equals(fieldName)) {
                    deserializedBillingProfileProperties.status = BillingProfileStatus.fromString(reader.getString());
                } else if ("statusReasonCode".equals(fieldName)) {
                    deserializedBillingProfileProperties.statusReasonCode
                        = BillingProfileStatusReasonCode.fromString(reader.getString());
                } else if ("systemId".equals(fieldName)) {
                    deserializedBillingProfileProperties.systemId = reader.getString();
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedBillingProfileProperties.tags = tags;
                } else if ("targetClouds".equals(fieldName)) {
                    List targetClouds = reader.readArray(reader1 -> reader1.getString());
                    deserializedBillingProfileProperties.targetClouds = targetClouds;
                } else if ("currentPaymentTerm".equals(fieldName)) {
                    deserializedBillingProfileProperties.currentPaymentTerm
                        = BillingProfilePropertiesCurrentPaymentTerm.fromJson(reader);
                } else if ("otherPaymentTerms".equals(fieldName)) {
                    List otherPaymentTerms = reader.readArray(reader1 -> PaymentTerm.fromJson(reader1));
                    deserializedBillingProfileProperties.otherPaymentTerms = otherPaymentTerms;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedBillingProfileProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy