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

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

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

    /*
     * The current status of the billing account.
     */
    private AccountStatus accountStatus;

    /*
     * The type of customer.
     */
    private AccountType accountType;

    /*
     * The tier of the account.
     */
    private AccountSubType accountSubType;

    /*
     * Reason for the specified billing account status.
     */
    private BillingAccountStatusReasonCode accountStatusReasonCode;

    /*
     * The type of agreement.
     */
    private AgreementType agreementType;

    /*
     * The billing account name.
     */
    private String displayName;

    /*
     * The properties of an enrollment.
     */
    private BillingAccountPropertiesEnrollmentDetails enrollmentDetails;

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

    /*
     * Indicates whether or not the billing account has any billing profiles.
     */
    private Boolean hasNoBillingProfiles;

    /*
     * Notification email address for legacy account. Available for agreement type Microsoft Online Services Program.
     */
    private String notificationEmailAddress;

    /*
     * The tenant that was used to set up the billing account. By default, only users from this tenant can get role
     * assignments on the billing account and all purchases are provisioned in this tenant.
     */
    private String primaryBillingTenantId;

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

    /*
     * Describes the registration number of the organization linked with the billing account.
     */
    private BillingAccountPropertiesRegistrationNumber registrationNumber;

    /*
     * Identifies the billing relationships represented by a billing account. The billing relationship may be between
     * Microsoft, the customer, and/or a third-party.
     */
    private List billingRelationshipTypes;

    /*
     * Qualifications for pricing on a billing account. Values may be Commercial, Education, Charity or Government.
     */
    private List qualifications;

    /*
     * A list of tax identifiers for the billing account.
     */
    private List taxIds;

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

    /**
     * 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 accountStatus property: The current status of the billing account.
     * 
     * @return the accountStatus value.
     */
    public AccountStatus accountStatus() {
        return this.accountStatus;
    }

    /**
     * Get the accountType property: The type of customer.
     * 
     * @return the accountType value.
     */
    public AccountType accountType() {
        return this.accountType;
    }

    /**
     * Get the accountSubType property: The tier of the account.
     * 
     * @return the accountSubType value.
     */
    public AccountSubType accountSubType() {
        return this.accountSubType;
    }

    /**
     * Get the accountStatusReasonCode property: Reason for the specified billing account status.
     * 
     * @return the accountStatusReasonCode value.
     */
    public BillingAccountStatusReasonCode accountStatusReasonCode() {
        return this.accountStatusReasonCode;
    }

    /**
     * Get the agreementType property: The type of agreement.
     * 
     * @return the agreementType value.
     */
    public AgreementType agreementType() {
        return this.agreementType;
    }

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

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

    /**
     * Get the enrollmentDetails property: The properties of an enrollment.
     * 
     * @return the enrollmentDetails value.
     */
    public BillingAccountPropertiesEnrollmentDetails enrollmentDetails() {
        return this.enrollmentDetails;
    }

    /**
     * Set the enrollmentDetails property: The properties of an enrollment.
     * 
     * @param enrollmentDetails the enrollmentDetails value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties withEnrollmentDetails(BillingAccountPropertiesEnrollmentDetails enrollmentDetails) {
        this.enrollmentDetails = enrollmentDetails;
        return this;
    }

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

    /**
     * Set the hasReadAccess property: Indicates whether user has read access to the billing account.
     * 
     * @param hasReadAccess the hasReadAccess value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties withHasReadAccess(Boolean hasReadAccess) {
        this.hasReadAccess = hasReadAccess;
        return this;
    }

    /**
     * Get the hasNoBillingProfiles property: Indicates whether or not the billing account has any billing profiles.
     * 
     * @return the hasNoBillingProfiles value.
     */
    public Boolean hasNoBillingProfiles() {
        return this.hasNoBillingProfiles;
    }

    /**
     * Set the hasNoBillingProfiles property: Indicates whether or not the billing account has any billing profiles.
     * 
     * @param hasNoBillingProfiles the hasNoBillingProfiles value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties withHasNoBillingProfiles(Boolean hasNoBillingProfiles) {
        this.hasNoBillingProfiles = hasNoBillingProfiles;
        return this;
    }

    /**
     * Get the notificationEmailAddress property: Notification email address for legacy account. Available for agreement
     * type Microsoft Online Services Program.
     * 
     * @return the notificationEmailAddress value.
     */
    public String notificationEmailAddress() {
        return this.notificationEmailAddress;
    }

    /**
     * Set the notificationEmailAddress property: Notification email address for legacy account. Available for agreement
     * type Microsoft Online Services Program.
     * 
     * @param notificationEmailAddress the notificationEmailAddress value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties withNotificationEmailAddress(String notificationEmailAddress) {
        this.notificationEmailAddress = notificationEmailAddress;
        return this;
    }

    /**
     * Get the primaryBillingTenantId property: The tenant that was used to set up the billing account. By default, only
     * users from this tenant can get role assignments on the billing account and all purchases are provisioned in this
     * tenant.
     * 
     * @return the primaryBillingTenantId value.
     */
    public String primaryBillingTenantId() {
        return this.primaryBillingTenantId;
    }

    /**
     * Set the primaryBillingTenantId property: The tenant that was used to set up the billing account. By default, only
     * users from this tenant can get role assignments on the billing account and all purchases are provisioned in this
     * tenant.
     * 
     * @param primaryBillingTenantId the primaryBillingTenantId value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties withPrimaryBillingTenantId(String primaryBillingTenantId) {
        this.primaryBillingTenantId = primaryBillingTenantId;
        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 BillingAccountPropertiesSoldTo 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 BillingAccountProperties object itself.
     */
    public BillingAccountProperties withSoldTo(BillingAccountPropertiesSoldTo soldTo) {
        this.soldTo = soldTo;
        return this;
    }

    /**
     * Get the registrationNumber property: Describes the registration number of the organization linked with the
     * billing account.
     * 
     * @return the registrationNumber value.
     */
    public BillingAccountPropertiesRegistrationNumber registrationNumber() {
        return this.registrationNumber;
    }

    /**
     * Set the registrationNumber property: Describes the registration number of the organization linked with the
     * billing account.
     * 
     * @param registrationNumber the registrationNumber value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties
        withRegistrationNumber(BillingAccountPropertiesRegistrationNumber registrationNumber) {
        this.registrationNumber = registrationNumber;
        return this;
    }

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

    /**
     * Get the qualifications property: Qualifications for pricing on a billing account. Values may be Commercial,
     * Education, Charity or Government.
     * 
     * @return the qualifications value.
     */
    public List qualifications() {
        return this.qualifications;
    }

    /**
     * Get the taxIds property: A list of tax identifiers for the billing account.
     * 
     * @return the taxIds value.
     */
    public List taxIds() {
        return this.taxIds;
    }

    /**
     * Set the taxIds property: A list of tax identifiers for the billing account.
     * 
     * @param taxIds the taxIds value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties withTaxIds(List taxIds) {
        this.taxIds = taxIds;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (enrollmentDetails() != null) {
            enrollmentDetails().validate();
        }
        if (soldTo() != null) {
            soldTo().validate();
        }
        if (registrationNumber() != null) {
            registrationNumber().validate();
        }
        if (taxIds() != null) {
            taxIds().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("displayName", this.displayName);
        jsonWriter.writeJsonField("enrollmentDetails", this.enrollmentDetails);
        jsonWriter.writeBooleanField("hasReadAccess", this.hasReadAccess);
        jsonWriter.writeBooleanField("hasNoBillingProfiles", this.hasNoBillingProfiles);
        jsonWriter.writeStringField("notificationEmailAddress", this.notificationEmailAddress);
        jsonWriter.writeStringField("primaryBillingTenantId", this.primaryBillingTenantId);
        jsonWriter.writeJsonField("soldTo", this.soldTo);
        jsonWriter.writeJsonField("registrationNumber", this.registrationNumber);
        jsonWriter.writeArrayField("taxIds", this.taxIds, (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("provisioningState".equals(fieldName)) {
                    deserializedBillingAccountProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("accountStatus".equals(fieldName)) {
                    deserializedBillingAccountProperties.accountStatus = AccountStatus.fromString(reader.getString());
                } else if ("accountType".equals(fieldName)) {
                    deserializedBillingAccountProperties.accountType = AccountType.fromString(reader.getString());
                } else if ("accountSubType".equals(fieldName)) {
                    deserializedBillingAccountProperties.accountSubType = AccountSubType.fromString(reader.getString());
                } else if ("accountStatusReasonCode".equals(fieldName)) {
                    deserializedBillingAccountProperties.accountStatusReasonCode
                        = BillingAccountStatusReasonCode.fromString(reader.getString());
                } else if ("agreementType".equals(fieldName)) {
                    deserializedBillingAccountProperties.agreementType = AgreementType.fromString(reader.getString());
                } else if ("displayName".equals(fieldName)) {
                    deserializedBillingAccountProperties.displayName = reader.getString();
                } else if ("enrollmentDetails".equals(fieldName)) {
                    deserializedBillingAccountProperties.enrollmentDetails
                        = BillingAccountPropertiesEnrollmentDetails.fromJson(reader);
                } else if ("hasReadAccess".equals(fieldName)) {
                    deserializedBillingAccountProperties.hasReadAccess = reader.getNullable(JsonReader::getBoolean);
                } else if ("hasNoBillingProfiles".equals(fieldName)) {
                    deserializedBillingAccountProperties.hasNoBillingProfiles
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("notificationEmailAddress".equals(fieldName)) {
                    deserializedBillingAccountProperties.notificationEmailAddress = reader.getString();
                } else if ("primaryBillingTenantId".equals(fieldName)) {
                    deserializedBillingAccountProperties.primaryBillingTenantId = reader.getString();
                } else if ("soldTo".equals(fieldName)) {
                    deserializedBillingAccountProperties.soldTo = BillingAccountPropertiesSoldTo.fromJson(reader);
                } else if ("registrationNumber".equals(fieldName)) {
                    deserializedBillingAccountProperties.registrationNumber
                        = BillingAccountPropertiesRegistrationNumber.fromJson(reader);
                } else if ("billingRelationshipTypes".equals(fieldName)) {
                    List billingRelationshipTypes
                        = reader.readArray(reader1 -> BillingRelationshipType.fromString(reader1.getString()));
                    deserializedBillingAccountProperties.billingRelationshipTypes = billingRelationshipTypes;
                } else if ("qualifications".equals(fieldName)) {
                    List qualifications = reader.readArray(reader1 -> reader1.getString());
                    deserializedBillingAccountProperties.qualifications = qualifications;
                } else if ("taxIds".equals(fieldName)) {
                    List taxIds = reader.readArray(reader1 -> TaxIdentifier.fromJson(reader1));
                    deserializedBillingAccountProperties.taxIds = taxIds;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedBillingAccountProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy