// 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.AccountStatus;
import com.azure.resourcemanager.billing.models.AccountType;
import com.azure.resourcemanager.billing.models.AddressDetails;
import com.azure.resourcemanager.billing.models.AgreementType;
import com.azure.resourcemanager.billing.models.BillingProfilesOnExpand;
import com.azure.resourcemanager.billing.models.Department;
import com.azure.resourcemanager.billing.models.Enrollment;
import com.azure.resourcemanager.billing.models.EnrollmentAccount;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

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

    /*
     * The address of the individual or organization that is responsible for the billing account.
     */
    @JsonProperty(value = "soldTo")
    private AddressDetails soldTo;

    /*
     * The type of agreement.
     */
    @JsonProperty(value = "agreementType", access = JsonProperty.Access.WRITE_ONLY)
    private AgreementType agreementType;

    /*
     * The type of customer.
     */
    @JsonProperty(value = "accountType", access = JsonProperty.Access.WRITE_ONLY)
    private AccountType accountType;

    /*
     * The current status of the billing account.
     */
    @JsonProperty(value = "accountStatus", access = JsonProperty.Access.WRITE_ONLY)
    private AccountStatus accountStatus;

    /*
     * The billing profiles associated with the billing account. By default this is not populated, unless it's
     * specified in $expand.
     */
    @JsonProperty(value = "billingProfiles")
    private BillingProfilesOnExpand billingProfiles;

    /*
     * The details about the associated legacy enrollment. By default this is not populated, unless it's specified in
     * $expand.
     */
    @JsonProperty(value = "enrollmentDetails", access = JsonProperty.Access.WRITE_ONLY)
    private Enrollment enrollmentDetails;

    /*
     * The departments associated to the enrollment.
     */
    @JsonProperty(value = "departments")
    private List<Department> departments;

    /*
     * The accounts associated to the enrollment.
     */
    @JsonProperty(value = "enrollmentAccounts")
    private List<EnrollmentAccount> enrollmentAccounts;

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

    /*
     * Notification email address, only for legacy accounts
     */
    @JsonProperty(value = "notificationEmailAddress")
    private String notificationEmailAddress;

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

    /**
     * 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 soldTo property: The address of the individual or organization that is responsible for the billing
     * account.
     *
     * @return the soldTo value.
     */
    public AddressDetails 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(AddressDetails soldTo) {
        this.soldTo = soldTo;
        return this;
    }

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

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

    /**
     * Get the accountStatus property: The current status of the billing account.
     *
     * @return the accountStatus value.
     */
    public AccountStatus accountStatus() {
        return this.accountStatus;
    }

    /**
     * Get the billingProfiles property: The billing profiles associated with the billing account. By default this is
     * not populated, unless it's specified in $expand.
     *
     * @return the billingProfiles value.
     */
    public BillingProfilesOnExpand billingProfiles() {
        return this.billingProfiles;
    }

    /**
     * Set the billingProfiles property: The billing profiles associated with the billing account. By default this is
     * not populated, unless it's specified in $expand.
     *
     * @param billingProfiles the billingProfiles value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties withBillingProfiles(BillingProfilesOnExpand billingProfiles) {
        this.billingProfiles = billingProfiles;
        return this;
    }

    /**
     * Get the enrollmentDetails property: The details about the associated legacy enrollment. By default this is not
     * populated, unless it's specified in $expand.
     *
     * @return the enrollmentDetails value.
     */
    public Enrollment enrollmentDetails() {
        return this.enrollmentDetails;
    }

    /**
     * Get the departments property: The departments associated to the enrollment.
     *
     * @return the departments value.
     */
    public List<Department> departments() {
        return this.departments;
    }

    /**
     * Set the departments property: The departments associated to the enrollment.
     *
     * @param departments the departments value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties withDepartments(List<Department> departments) {
        this.departments = departments;
        return this;
    }

    /**
     * Get the enrollmentAccounts property: The accounts associated to the enrollment.
     *
     * @return the enrollmentAccounts value.
     */
    public List<EnrollmentAccount> enrollmentAccounts() {
        return this.enrollmentAccounts;
    }

    /**
     * Set the enrollmentAccounts property: The accounts associated to the enrollment.
     *
     * @param enrollmentAccounts the enrollmentAccounts value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties withEnrollmentAccounts(List<EnrollmentAccount> enrollmentAccounts) {
        this.enrollmentAccounts = enrollmentAccounts;
        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;
    }

    /**
     * Get the notificationEmailAddress property: Notification email address, only for legacy accounts.
     *
     * @return the notificationEmailAddress value.
     */
    public String notificationEmailAddress() {
        return this.notificationEmailAddress;
    }

    /**
     * Set the notificationEmailAddress property: Notification email address, only for legacy accounts.
     *
     * @param notificationEmailAddress the notificationEmailAddress value to set.
     * @return the BillingAccountProperties object itself.
     */
    public BillingAccountProperties withNotificationEmailAddress(String notificationEmailAddress) {
        this.notificationEmailAddress = notificationEmailAddress;
        return this;
    }

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