// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.hdinsight.containers.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterPoolResourcePropertiesAksClusterProfile;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterPoolResourcePropertiesClusterPoolProfile;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterPoolResourcePropertiesComputeProfile;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterPoolResourcePropertiesLogAnalyticsProfile;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterPoolResourcePropertiesNetworkProfile;
import com.azure.resourcemanager.hdinsight.containers.models.ProvisioningStatus;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Cluster pool resource properties. */
@Fluent
public final class ClusterPoolResourceProperties {
    /*
     * Provisioning state of the resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningStatus provisioningState;

    /*
     * A unique id generated by the RP to identify the resource.
     */
    @JsonProperty(value = "deploymentId", access = JsonProperty.Access.WRITE_ONLY)
    private String deploymentId;

    /*
     * A resource group created by RP, to hold the resources created by RP on-behalf of customers. It will also be used
     * to generate aksManagedResourceGroupName by pattern: MC_{managedResourceGroupName}_{clusterPoolName}_{region}.
     * Please make sure it meets resource group name restriction.
     */
    @JsonProperty(value = "managedResourceGroupName")
    private String managedResourceGroupName;

    /*
     * A resource group created by AKS, to hold the infrastructure resources created by AKS on-behalf of customers. It
     * is generated by cluster pool name and managed resource group name by pattern:
     * MC_{managedResourceGroupName}_{clusterPoolName}_{region}
     */
    @JsonProperty(value = "aksManagedResourceGroupName", access = JsonProperty.Access.WRITE_ONLY)
    private String aksManagedResourceGroupName;

    /*
     * CLuster pool profile.
     */
    @JsonProperty(value = "clusterPoolProfile")
    private ClusterPoolResourcePropertiesClusterPoolProfile clusterPoolProfile;

    /*
     * CLuster pool compute profile.
     */
    @JsonProperty(value = "computeProfile", required = true)
    private ClusterPoolResourcePropertiesComputeProfile computeProfile;

    /*
     * Properties of underlying AKS cluster.
     */
    @JsonProperty(value = "aksClusterProfile", access = JsonProperty.Access.WRITE_ONLY)
    private ClusterPoolResourcePropertiesAksClusterProfile aksClusterProfile;

    /*
     * Cluster pool network profile.
     */
    @JsonProperty(value = "networkProfile")
    private ClusterPoolResourcePropertiesNetworkProfile networkProfile;

    /*
     * Cluster pool log analytics profile to enable OMS agent for AKS cluster.
     */
    @JsonProperty(value = "logAnalyticsProfile")
    private ClusterPoolResourcePropertiesLogAnalyticsProfile logAnalyticsProfile;

    /*
     * Business status of the resource.
     */
    @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
    private String status;

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

    /**
     * Get the provisioningState property: Provisioning state of the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningStatus provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the deploymentId property: A unique id generated by the RP to identify the resource.
     *
     * @return the deploymentId value.
     */
    public String deploymentId() {
        return this.deploymentId;
    }

    /**
     * Get the managedResourceGroupName property: A resource group created by RP, to hold the resources created by RP
     * on-behalf of customers. It will also be used to generate aksManagedResourceGroupName by pattern:
     * MC_{managedResourceGroupName}_{clusterPoolName}_{region}. Please make sure it meets resource group name
     * restriction.
     *
     * @return the managedResourceGroupName value.
     */
    public String managedResourceGroupName() {
        return this.managedResourceGroupName;
    }

    /**
     * Set the managedResourceGroupName property: A resource group created by RP, to hold the resources created by RP
     * on-behalf of customers. It will also be used to generate aksManagedResourceGroupName by pattern:
     * MC_{managedResourceGroupName}_{clusterPoolName}_{region}. Please make sure it meets resource group name
     * restriction.
     *
     * @param managedResourceGroupName the managedResourceGroupName value to set.
     * @return the ClusterPoolResourceProperties object itself.
     */
    public ClusterPoolResourceProperties withManagedResourceGroupName(String managedResourceGroupName) {
        this.managedResourceGroupName = managedResourceGroupName;
        return this;
    }

    /**
     * Get the aksManagedResourceGroupName property: A resource group created by AKS, to hold the infrastructure
     * resources created by AKS on-behalf of customers. It is generated by cluster pool name and managed resource group
     * name by pattern: MC_{managedResourceGroupName}_{clusterPoolName}_{region}.
     *
     * @return the aksManagedResourceGroupName value.
     */
    public String aksManagedResourceGroupName() {
        return this.aksManagedResourceGroupName;
    }

    /**
     * Get the clusterPoolProfile property: CLuster pool profile.
     *
     * @return the clusterPoolProfile value.
     */
    public ClusterPoolResourcePropertiesClusterPoolProfile clusterPoolProfile() {
        return this.clusterPoolProfile;
    }

    /**
     * Set the clusterPoolProfile property: CLuster pool profile.
     *
     * @param clusterPoolProfile the clusterPoolProfile value to set.
     * @return the ClusterPoolResourceProperties object itself.
     */
    public ClusterPoolResourceProperties withClusterPoolProfile(
        ClusterPoolResourcePropertiesClusterPoolProfile clusterPoolProfile) {
        this.clusterPoolProfile = clusterPoolProfile;
        return this;
    }

    /**
     * Get the computeProfile property: CLuster pool compute profile.
     *
     * @return the computeProfile value.
     */
    public ClusterPoolResourcePropertiesComputeProfile computeProfile() {
        return this.computeProfile;
    }

    /**
     * Set the computeProfile property: CLuster pool compute profile.
     *
     * @param computeProfile the computeProfile value to set.
     * @return the ClusterPoolResourceProperties object itself.
     */
    public ClusterPoolResourceProperties withComputeProfile(
        ClusterPoolResourcePropertiesComputeProfile computeProfile) {
        this.computeProfile = computeProfile;
        return this;
    }

    /**
     * Get the aksClusterProfile property: Properties of underlying AKS cluster.
     *
     * @return the aksClusterProfile value.
     */
    public ClusterPoolResourcePropertiesAksClusterProfile aksClusterProfile() {
        return this.aksClusterProfile;
    }

    /**
     * Get the networkProfile property: Cluster pool network profile.
     *
     * @return the networkProfile value.
     */
    public ClusterPoolResourcePropertiesNetworkProfile networkProfile() {
        return this.networkProfile;
    }

    /**
     * Set the networkProfile property: Cluster pool network profile.
     *
     * @param networkProfile the networkProfile value to set.
     * @return the ClusterPoolResourceProperties object itself.
     */
    public ClusterPoolResourceProperties withNetworkProfile(
        ClusterPoolResourcePropertiesNetworkProfile networkProfile) {
        this.networkProfile = networkProfile;
        return this;
    }

    /**
     * Get the logAnalyticsProfile property: Cluster pool log analytics profile to enable OMS agent for AKS cluster.
     *
     * @return the logAnalyticsProfile value.
     */
    public ClusterPoolResourcePropertiesLogAnalyticsProfile logAnalyticsProfile() {
        return this.logAnalyticsProfile;
    }

    /**
     * Set the logAnalyticsProfile property: Cluster pool log analytics profile to enable OMS agent for AKS cluster.
     *
     * @param logAnalyticsProfile the logAnalyticsProfile value to set.
     * @return the ClusterPoolResourceProperties object itself.
     */
    public ClusterPoolResourceProperties withLogAnalyticsProfile(
        ClusterPoolResourcePropertiesLogAnalyticsProfile logAnalyticsProfile) {
        this.logAnalyticsProfile = logAnalyticsProfile;
        return this;
    }

    /**
     * Get the status property: Business status of the resource.
     *
     * @return the status value.
     */
    public String status() {
        return this.status;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (clusterPoolProfile() != null) {
            clusterPoolProfile().validate();
        }
        if (computeProfile() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property computeProfile in model ClusterPoolResourceProperties"));
        } else {
            computeProfile().validate();
        }
        if (aksClusterProfile() != null) {
            aksClusterProfile().validate();
        }
        if (networkProfile() != null) {
            networkProfile().validate();
        }
        if (logAnalyticsProfile() != null) {
            logAnalyticsProfile().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(ClusterPoolResourceProperties.class);
}
