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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Cluster profile. */
@Fluent
public final class ClusterProfile {
    /*
     * Version with 3/4 part.
     */
    @JsonProperty(value = "clusterVersion", required = true)
    private String clusterVersion;

    /*
     * Version with three part.
     */
    @JsonProperty(value = "ossVersion", required = true)
    private String ossVersion;

    /*
     * Component list of this cluster type and version.
     */
    @JsonProperty(value = "components", access = JsonProperty.Access.WRITE_ONLY)
    private List<ClusterComponentsItem> components;

    /*
     * Identity Profile with details of an MSI.
     */
    @JsonProperty(value = "identityProfile", required = true)
    private IdentityProfile identityProfile;

    /*
     * Authorization profile with details of AAD user Ids and group Ids authorized for data plane access.
     */
    @JsonProperty(value = "authorizationProfile", required = true)
    private AuthorizationProfile authorizationProfile;

    /*
     * The cluster secret profile.
     */
    @JsonProperty(value = "secretsProfile")
    private SecretsProfile secretsProfile;

    /*
     * The service configs profiles.
     */
    @JsonProperty(value = "serviceConfigsProfiles")
    private List<ClusterServiceConfigsProfile> serviceConfigsProfiles;

    /*
     * Cluster connectivity profile.
     */
    @JsonProperty(value = "connectivityProfile", access = JsonProperty.Access.WRITE_ONLY)
    private ConnectivityProfile connectivityProfile;

    /*
     * Cluster log analytics profile to enable or disable OMS agent for cluster.
     */
    @JsonProperty(value = "logAnalyticsProfile")
    private ClusterLogAnalyticsProfile logAnalyticsProfile;

    /*
     * Cluster Prometheus profile.
     */
    @JsonProperty(value = "prometheusProfile")
    private ClusterPrometheusProfile prometheusProfile;

    /*
     * Ssh profile for the cluster.
     */
    @JsonProperty(value = "sshProfile")
    private SshProfile sshProfile;

    /*
     * This is the Autoscale profile for the cluster. This will allow customer to create cluster enabled with
     * Autoscale.
     */
    @JsonProperty(value = "autoscaleProfile")
    private AutoscaleProfile autoscaleProfile;

    /*
     * Kafka cluster profile.
     */
    @JsonProperty(value = "kafkaProfile")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, Object> kafkaProfile;

    /*
     * Trino Cluster profile.
     */
    @JsonProperty(value = "trinoProfile")
    private TrinoProfile trinoProfile;

    /*
     * LLAP cluster profile.
     */
    @JsonProperty(value = "llapProfile")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, Object> llapProfile;

    /*
     * The Flink cluster profile.
     */
    @JsonProperty(value = "flinkProfile")
    private FlinkProfile flinkProfile;

    /*
     * The spark cluster profile.
     */
    @JsonProperty(value = "sparkProfile")
    private SparkProfile sparkProfile;

    /*
     * Stub cluster profile.
     */
    @JsonProperty(value = "stubProfile")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, Object> stubProfile;

    /*
     * The script action profile list.
     */
    @JsonProperty(value = "scriptActionProfiles")
    private List<ScriptActionProfile> scriptActionProfiles;

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

    /**
     * Get the clusterVersion property: Version with 3/4 part.
     *
     * @return the clusterVersion value.
     */
    public String clusterVersion() {
        return this.clusterVersion;
    }

    /**
     * Set the clusterVersion property: Version with 3/4 part.
     *
     * @param clusterVersion the clusterVersion value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withClusterVersion(String clusterVersion) {
        this.clusterVersion = clusterVersion;
        return this;
    }

    /**
     * Get the ossVersion property: Version with three part.
     *
     * @return the ossVersion value.
     */
    public String ossVersion() {
        return this.ossVersion;
    }

    /**
     * Set the ossVersion property: Version with three part.
     *
     * @param ossVersion the ossVersion value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withOssVersion(String ossVersion) {
        this.ossVersion = ossVersion;
        return this;
    }

    /**
     * Get the components property: Component list of this cluster type and version.
     *
     * @return the components value.
     */
    public List<ClusterComponentsItem> components() {
        return this.components;
    }

    /**
     * Get the identityProfile property: Identity Profile with details of an MSI.
     *
     * @return the identityProfile value.
     */
    public IdentityProfile identityProfile() {
        return this.identityProfile;
    }

    /**
     * Set the identityProfile property: Identity Profile with details of an MSI.
     *
     * @param identityProfile the identityProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withIdentityProfile(IdentityProfile identityProfile) {
        this.identityProfile = identityProfile;
        return this;
    }

    /**
     * Get the authorizationProfile property: Authorization profile with details of AAD user Ids and group Ids
     * authorized for data plane access.
     *
     * @return the authorizationProfile value.
     */
    public AuthorizationProfile authorizationProfile() {
        return this.authorizationProfile;
    }

    /**
     * Set the authorizationProfile property: Authorization profile with details of AAD user Ids and group Ids
     * authorized for data plane access.
     *
     * @param authorizationProfile the authorizationProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withAuthorizationProfile(AuthorizationProfile authorizationProfile) {
        this.authorizationProfile = authorizationProfile;
        return this;
    }

    /**
     * Get the secretsProfile property: The cluster secret profile.
     *
     * @return the secretsProfile value.
     */
    public SecretsProfile secretsProfile() {
        return this.secretsProfile;
    }

    /**
     * Set the secretsProfile property: The cluster secret profile.
     *
     * @param secretsProfile the secretsProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withSecretsProfile(SecretsProfile secretsProfile) {
        this.secretsProfile = secretsProfile;
        return this;
    }

    /**
     * Get the serviceConfigsProfiles property: The service configs profiles.
     *
     * @return the serviceConfigsProfiles value.
     */
    public List<ClusterServiceConfigsProfile> serviceConfigsProfiles() {
        return this.serviceConfigsProfiles;
    }

    /**
     * Set the serviceConfigsProfiles property: The service configs profiles.
     *
     * @param serviceConfigsProfiles the serviceConfigsProfiles value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withServiceConfigsProfiles(List<ClusterServiceConfigsProfile> serviceConfigsProfiles) {
        this.serviceConfigsProfiles = serviceConfigsProfiles;
        return this;
    }

    /**
     * Get the connectivityProfile property: Cluster connectivity profile.
     *
     * @return the connectivityProfile value.
     */
    public ConnectivityProfile connectivityProfile() {
        return this.connectivityProfile;
    }

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

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

    /**
     * Get the prometheusProfile property: Cluster Prometheus profile.
     *
     * @return the prometheusProfile value.
     */
    public ClusterPrometheusProfile prometheusProfile() {
        return this.prometheusProfile;
    }

    /**
     * Set the prometheusProfile property: Cluster Prometheus profile.
     *
     * @param prometheusProfile the prometheusProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withPrometheusProfile(ClusterPrometheusProfile prometheusProfile) {
        this.prometheusProfile = prometheusProfile;
        return this;
    }

    /**
     * Get the sshProfile property: Ssh profile for the cluster.
     *
     * @return the sshProfile value.
     */
    public SshProfile sshProfile() {
        return this.sshProfile;
    }

    /**
     * Set the sshProfile property: Ssh profile for the cluster.
     *
     * @param sshProfile the sshProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withSshProfile(SshProfile sshProfile) {
        this.sshProfile = sshProfile;
        return this;
    }

    /**
     * Get the autoscaleProfile property: This is the Autoscale profile for the cluster. This will allow customer to
     * create cluster enabled with Autoscale.
     *
     * @return the autoscaleProfile value.
     */
    public AutoscaleProfile autoscaleProfile() {
        return this.autoscaleProfile;
    }

    /**
     * Set the autoscaleProfile property: This is the Autoscale profile for the cluster. This will allow customer to
     * create cluster enabled with Autoscale.
     *
     * @param autoscaleProfile the autoscaleProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withAutoscaleProfile(AutoscaleProfile autoscaleProfile) {
        this.autoscaleProfile = autoscaleProfile;
        return this;
    }

    /**
     * Get the kafkaProfile property: Kafka cluster profile.
     *
     * @return the kafkaProfile value.
     */
    public Map<String, Object> kafkaProfile() {
        return this.kafkaProfile;
    }

    /**
     * Set the kafkaProfile property: Kafka cluster profile.
     *
     * @param kafkaProfile the kafkaProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withKafkaProfile(Map<String, Object> kafkaProfile) {
        this.kafkaProfile = kafkaProfile;
        return this;
    }

    /**
     * Get the trinoProfile property: Trino Cluster profile.
     *
     * @return the trinoProfile value.
     */
    public TrinoProfile trinoProfile() {
        return this.trinoProfile;
    }

    /**
     * Set the trinoProfile property: Trino Cluster profile.
     *
     * @param trinoProfile the trinoProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withTrinoProfile(TrinoProfile trinoProfile) {
        this.trinoProfile = trinoProfile;
        return this;
    }

    /**
     * Get the llapProfile property: LLAP cluster profile.
     *
     * @return the llapProfile value.
     */
    public Map<String, Object> llapProfile() {
        return this.llapProfile;
    }

    /**
     * Set the llapProfile property: LLAP cluster profile.
     *
     * @param llapProfile the llapProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withLlapProfile(Map<String, Object> llapProfile) {
        this.llapProfile = llapProfile;
        return this;
    }

    /**
     * Get the flinkProfile property: The Flink cluster profile.
     *
     * @return the flinkProfile value.
     */
    public FlinkProfile flinkProfile() {
        return this.flinkProfile;
    }

    /**
     * Set the flinkProfile property: The Flink cluster profile.
     *
     * @param flinkProfile the flinkProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withFlinkProfile(FlinkProfile flinkProfile) {
        this.flinkProfile = flinkProfile;
        return this;
    }

    /**
     * Get the sparkProfile property: The spark cluster profile.
     *
     * @return the sparkProfile value.
     */
    public SparkProfile sparkProfile() {
        return this.sparkProfile;
    }

    /**
     * Set the sparkProfile property: The spark cluster profile.
     *
     * @param sparkProfile the sparkProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withSparkProfile(SparkProfile sparkProfile) {
        this.sparkProfile = sparkProfile;
        return this;
    }

    /**
     * Get the stubProfile property: Stub cluster profile.
     *
     * @return the stubProfile value.
     */
    public Map<String, Object> stubProfile() {
        return this.stubProfile;
    }

    /**
     * Set the stubProfile property: Stub cluster profile.
     *
     * @param stubProfile the stubProfile value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withStubProfile(Map<String, Object> stubProfile) {
        this.stubProfile = stubProfile;
        return this;
    }

    /**
     * Get the scriptActionProfiles property: The script action profile list.
     *
     * @return the scriptActionProfiles value.
     */
    public List<ScriptActionProfile> scriptActionProfiles() {
        return this.scriptActionProfiles;
    }

    /**
     * Set the scriptActionProfiles property: The script action profile list.
     *
     * @param scriptActionProfiles the scriptActionProfiles value to set.
     * @return the ClusterProfile object itself.
     */
    public ClusterProfile withScriptActionProfiles(List<ScriptActionProfile> scriptActionProfiles) {
        this.scriptActionProfiles = scriptActionProfiles;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (clusterVersion() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property clusterVersion in model ClusterProfile"));
        }
        if (ossVersion() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property ossVersion in model ClusterProfile"));
        }
        if (components() != null) {
            components().forEach(e -> e.validate());
        }
        if (identityProfile() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property identityProfile in model ClusterProfile"));
        } else {
            identityProfile().validate();
        }
        if (authorizationProfile() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property authorizationProfile in model ClusterProfile"));
        } else {
            authorizationProfile().validate();
        }
        if (secretsProfile() != null) {
            secretsProfile().validate();
        }
        if (serviceConfigsProfiles() != null) {
            serviceConfigsProfiles().forEach(e -> e.validate());
        }
        if (connectivityProfile() != null) {
            connectivityProfile().validate();
        }
        if (logAnalyticsProfile() != null) {
            logAnalyticsProfile().validate();
        }
        if (prometheusProfile() != null) {
            prometheusProfile().validate();
        }
        if (sshProfile() != null) {
            sshProfile().validate();
        }
        if (autoscaleProfile() != null) {
            autoscaleProfile().validate();
        }
        if (trinoProfile() != null) {
            trinoProfile().validate();
        }
        if (flinkProfile() != null) {
            flinkProfile().validate();
        }
        if (sparkProfile() != null) {
            sparkProfile().validate();
        }
        if (scriptActionProfiles() != null) {
            scriptActionProfiles().forEach(e -> e.validate());
        }
    }

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