// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.billing.models.AddressDetails;
import com.azure.resourcemanager.billing.models.AzurePlan;
import com.azure.resourcemanager.billing.models.BillingProfileStatus;
import com.azure.resourcemanager.billing.models.BillingRelationshipType;
import com.azure.resourcemanager.billing.models.IndirectRelationshipInfo;
import com.azure.resourcemanager.billing.models.InvoiceSectionsOnExpand;
import com.azure.resourcemanager.billing.models.SpendingLimit;
import com.azure.resourcemanager.billing.models.StatusReasonCode;
import com.azure.resourcemanager.billing.models.TargetCloud;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** The properties of the billing profile. */
@Fluent
public final class BillingProfileProperties {
    /*
     * The name of the billing profile.
     */
    @JsonProperty(value = "displayName")
    private String displayName;

    /*
     * The purchase order name that will appear on the invoices generated for the billing profile.
     */
    @JsonProperty(value = "poNumber")
    private String poNumber;

    /*
     * Identifies which services and purchases are paid by a billing profile.
     */
    @JsonProperty(value = "billingRelationshipType", access = JsonProperty.Access.WRITE_ONLY)
    private BillingRelationshipType billingRelationshipType;

    /*
     * Billing address.
     */
    @JsonProperty(value = "billTo")
    private AddressDetails billTo;

    /*
     * Identifies the billing profile that is linked to another billing profile in indirect purchase motion.
     */
    @JsonProperty(value = "indirectRelationshipInfo", access = JsonProperty.Access.WRITE_ONLY)
    private IndirectRelationshipInfo indirectRelationshipInfo;

    /*
     * Flag controlling whether the invoices for the billing profile are sent through email.
     */
    @JsonProperty(value = "invoiceEmailOptIn")
    private Boolean invoiceEmailOptIn;

    /*
     * The day of the month when the invoice for the billing profile is generated.
     */
    @JsonProperty(value = "invoiceDay", access = JsonProperty.Access.WRITE_ONLY)
    private Integer invoiceDay;

    /*
     * The currency in which the charges for the billing profile are billed.
     */
    @JsonProperty(value = "currency", access = JsonProperty.Access.WRITE_ONLY)
    private String currency;

    /*
     * Information about the enabled azure plans.
     */
    @JsonProperty(value = "enabledAzurePlans")
    private List<AzurePlan> enabledAzurePlans;

    /*
     * The invoice sections associated to the billing profile. By default this is not populated, unless it's specified
     * in $expand.
     */
    @JsonProperty(value = "invoiceSections")
    private InvoiceSectionsOnExpand invoiceSections;

    /*
     * Indicates whether user has read access to the billing profile.
     */
    @JsonProperty(value = "hasReadAccess", access = JsonProperty.Access.WRITE_ONLY)
    private Boolean hasReadAccess;

    /*
     * The system generated unique identifier for a billing profile.
     */
    @JsonProperty(value = "systemId", access = JsonProperty.Access.WRITE_ONLY)
    private String systemId;

    /*
     * The status of the billing profile.
     */
    @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
    private BillingProfileStatus status;

    /*
     * Reason for the specified billing profile status.
     */
    @JsonProperty(value = "statusReasonCode", access = JsonProperty.Access.WRITE_ONLY)
    private StatusReasonCode statusReasonCode;

    /*
     * The billing profile spending limit.
     */
    @JsonProperty(value = "spendingLimit", access = JsonProperty.Access.WRITE_ONLY)
    private SpendingLimit spendingLimit;

    /*
     * 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.
     */
    @JsonProperty(value = "targetClouds", access = JsonProperty.Access.WRITE_ONLY)
    private List<TargetCloud> targetClouds;

    /*
     * Tags of billing profiles.
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

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

    /**
     * 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 poNumber property: The purchase order name 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 purchase order name 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 billingRelationshipType property: Identifies which services and purchases are paid by a billing profile.
     *
     * @return the billingRelationshipType value.
     */
    public BillingRelationshipType billingRelationshipType() {
        return this.billingRelationshipType;
    }

    /**
     * Get the billTo property: Billing address.
     *
     * @return the billTo value.
     */
    public AddressDetails 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(AddressDetails billTo) {
        this.billTo = billTo;
        return this;
    }

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

    /**
     * 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 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 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 enabledAzurePlans property: Information about the enabled azure plans.
     *
     * @return the enabledAzurePlans value.
     */
    public List<AzurePlan> 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<AzurePlan> enabledAzurePlans) {
        this.enabledAzurePlans = enabledAzurePlans;
        return this;
    }

    /**
     * Get the invoiceSections property: The invoice sections associated to the billing profile. By default this is not
     * populated, unless it's specified in $expand.
     *
     * @return the invoiceSections value.
     */
    public InvoiceSectionsOnExpand invoiceSections() {
        return this.invoiceSections;
    }

    /**
     * Set the invoiceSections property: The invoice sections associated to the billing profile. By default this is not
     * populated, unless it's specified in $expand.
     *
     * @param invoiceSections the invoiceSections value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withInvoiceSections(InvoiceSectionsOnExpand invoiceSections) {
        this.invoiceSections = invoiceSections;
        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 systemId property: The system generated unique identifier for a billing profile.
     *
     * @return the systemId value.
     */
    public String systemId() {
        return this.systemId;
    }

    /**
     * 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 StatusReasonCode statusReasonCode() {
        return this.statusReasonCode;
    }

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

    /**
     * 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<TargetCloud> targetClouds() {
        return this.targetClouds;
    }

    /**
     * Get the tags property: Tags of billing profiles.
     *
     * @return the tags value.
     */
    public Map<String, String> tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Tags of billing profiles.
     *
     * @param tags the tags value to set.
     * @return the BillingProfileProperties object itself.
     */
    public BillingProfileProperties withTags(Map<String, String> tags) {
        this.tags = tags;
        return this;
    }

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