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

package com.azure.resourcemanager.kusto.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.kusto.models.AcceptedAudiences;
import com.azure.resourcemanager.kusto.models.AzureSku;
import com.azure.resourcemanager.kusto.models.ClusterNetworkAccessFlag;
import com.azure.resourcemanager.kusto.models.EngineType;
import com.azure.resourcemanager.kusto.models.Identity;
import com.azure.resourcemanager.kusto.models.KeyVaultProperties;
import com.azure.resourcemanager.kusto.models.LanguageExtensionsList;
import com.azure.resourcemanager.kusto.models.MigrationClusterProperties;
import com.azure.resourcemanager.kusto.models.OptimizedAutoscale;
import com.azure.resourcemanager.kusto.models.ProvisioningState;
import com.azure.resourcemanager.kusto.models.PublicIpType;
import com.azure.resourcemanager.kusto.models.PublicNetworkAccess;
import com.azure.resourcemanager.kusto.models.State;
import com.azure.resourcemanager.kusto.models.TrustedExternalTenant;
import com.azure.resourcemanager.kusto.models.VirtualNetworkConfiguration;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Class representing a Kusto cluster. */
@Fluent
public final class ClusterInner extends Resource {
    /*
     * The SKU of the cluster.
     */
    @JsonProperty(value = "sku", required = true)
    private AzureSku sku;

    /*
     * Metadata pertaining to creation and last modification of the resource.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * The availability zones of the cluster.
     */
    @JsonProperty(value = "zones")
    private List<String> zones;

    /*
     * The identity of the cluster, if configured.
     */
    @JsonProperty(value = "identity")
    private Identity identity;

    /*
     * The cluster properties.
     */
    @JsonProperty(value = "properties")
    private ClusterProperties innerProperties;

    /*
     * A unique read-only string that changes whenever the resource is updated.
     */
    @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY)
    private String etag;

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

    /**
     * Get the sku property: The SKU of the cluster.
     *
     * @return the sku value.
     */
    public AzureSku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The SKU of the cluster.
     *
     * @param sku the sku value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withSku(AzureSku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the resource.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the zones property: The availability zones of the cluster.
     *
     * @return the zones value.
     */
    public List<String> zones() {
        return this.zones;
    }

    /**
     * Set the zones property: The availability zones of the cluster.
     *
     * @param zones the zones value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withZones(List<String> zones) {
        this.zones = zones;
        return this;
    }

    /**
     * Get the identity property: The identity of the cluster, if configured.
     *
     * @return the identity value.
     */
    public Identity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: The identity of the cluster, if configured.
     *
     * @param identity the identity value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withIdentity(Identity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the innerProperties property: The cluster properties.
     *
     * @return the innerProperties value.
     */
    private ClusterProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the etag property: A unique read-only string that changes whenever the resource is updated.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /** {@inheritDoc} */
    @Override
    public ClusterInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ClusterInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the state property: The state of the resource.
     *
     * @return the state value.
     */
    public State state() {
        return this.innerProperties() == null ? null : this.innerProperties().state();
    }

    /**
     * Get the provisioningState property: The provisioned state of the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the uri property: The cluster URI.
     *
     * @return the uri value.
     */
    public String uri() {
        return this.innerProperties() == null ? null : this.innerProperties().uri();
    }

    /**
     * Get the dataIngestionUri property: The cluster data ingestion URI.
     *
     * @return the dataIngestionUri value.
     */
    public String dataIngestionUri() {
        return this.innerProperties() == null ? null : this.innerProperties().dataIngestionUri();
    }

    /**
     * Get the stateReason property: The reason for the cluster's current state.
     *
     * @return the stateReason value.
     */
    public String stateReason() {
        return this.innerProperties() == null ? null : this.innerProperties().stateReason();
    }

    /**
     * Get the trustedExternalTenants property: The cluster's external tenants.
     *
     * @return the trustedExternalTenants value.
     */
    public List<TrustedExternalTenant> trustedExternalTenants() {
        return this.innerProperties() == null ? null : this.innerProperties().trustedExternalTenants();
    }

    /**
     * Set the trustedExternalTenants property: The cluster's external tenants.
     *
     * @param trustedExternalTenants the trustedExternalTenants value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withTrustedExternalTenants(List<TrustedExternalTenant> trustedExternalTenants) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withTrustedExternalTenants(trustedExternalTenants);
        return this;
    }

    /**
     * Get the optimizedAutoscale property: Optimized auto scale definition.
     *
     * @return the optimizedAutoscale value.
     */
    public OptimizedAutoscale optimizedAutoscale() {
        return this.innerProperties() == null ? null : this.innerProperties().optimizedAutoscale();
    }

    /**
     * Set the optimizedAutoscale property: Optimized auto scale definition.
     *
     * @param optimizedAutoscale the optimizedAutoscale value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withOptimizedAutoscale(OptimizedAutoscale optimizedAutoscale) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withOptimizedAutoscale(optimizedAutoscale);
        return this;
    }

    /**
     * Get the enableDiskEncryption property: A boolean value that indicates if the cluster's disks are encrypted.
     *
     * @return the enableDiskEncryption value.
     */
    public Boolean enableDiskEncryption() {
        return this.innerProperties() == null ? null : this.innerProperties().enableDiskEncryption();
    }

    /**
     * Set the enableDiskEncryption property: A boolean value that indicates if the cluster's disks are encrypted.
     *
     * @param enableDiskEncryption the enableDiskEncryption value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withEnableDiskEncryption(Boolean enableDiskEncryption) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withEnableDiskEncryption(enableDiskEncryption);
        return this;
    }

    /**
     * Get the enableStreamingIngest property: A boolean value that indicates if the streaming ingest is enabled.
     *
     * @return the enableStreamingIngest value.
     */
    public Boolean enableStreamingIngest() {
        return this.innerProperties() == null ? null : this.innerProperties().enableStreamingIngest();
    }

    /**
     * Set the enableStreamingIngest property: A boolean value that indicates if the streaming ingest is enabled.
     *
     * @param enableStreamingIngest the enableStreamingIngest value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withEnableStreamingIngest(Boolean enableStreamingIngest) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withEnableStreamingIngest(enableStreamingIngest);
        return this;
    }

    /**
     * Get the virtualNetworkConfiguration property: Virtual network definition.
     *
     * @return the virtualNetworkConfiguration value.
     */
    public VirtualNetworkConfiguration virtualNetworkConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().virtualNetworkConfiguration();
    }

    /**
     * Set the virtualNetworkConfiguration property: Virtual network definition.
     *
     * @param virtualNetworkConfiguration the virtualNetworkConfiguration value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withVirtualNetworkConfiguration(virtualNetworkConfiguration);
        return this;
    }

    /**
     * Get the keyVaultProperties property: KeyVault properties for the cluster encryption.
     *
     * @return the keyVaultProperties value.
     */
    public KeyVaultProperties keyVaultProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().keyVaultProperties();
    }

    /**
     * Set the keyVaultProperties property: KeyVault properties for the cluster encryption.
     *
     * @param keyVaultProperties the keyVaultProperties value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withKeyVaultProperties(KeyVaultProperties keyVaultProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withKeyVaultProperties(keyVaultProperties);
        return this;
    }

    /**
     * Get the enablePurge property: A boolean value that indicates if the purge operations are enabled.
     *
     * @return the enablePurge value.
     */
    public Boolean enablePurge() {
        return this.innerProperties() == null ? null : this.innerProperties().enablePurge();
    }

    /**
     * Set the enablePurge property: A boolean value that indicates if the purge operations are enabled.
     *
     * @param enablePurge the enablePurge value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withEnablePurge(Boolean enablePurge) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withEnablePurge(enablePurge);
        return this;
    }

    /**
     * Get the languageExtensions property: List of the cluster's language extensions.
     *
     * @return the languageExtensions value.
     */
    public LanguageExtensionsList languageExtensions() {
        return this.innerProperties() == null ? null : this.innerProperties().languageExtensions();
    }

    /**
     * Set the languageExtensions property: List of the cluster's language extensions.
     *
     * @param languageExtensions the languageExtensions value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withLanguageExtensions(LanguageExtensionsList languageExtensions) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withLanguageExtensions(languageExtensions);
        return this;
    }

    /**
     * Get the enableDoubleEncryption property: A boolean value that indicates if double encryption is enabled.
     *
     * @return the enableDoubleEncryption value.
     */
    public Boolean enableDoubleEncryption() {
        return this.innerProperties() == null ? null : this.innerProperties().enableDoubleEncryption();
    }

    /**
     * Set the enableDoubleEncryption property: A boolean value that indicates if double encryption is enabled.
     *
     * @param enableDoubleEncryption the enableDoubleEncryption value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withEnableDoubleEncryption(Boolean enableDoubleEncryption) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withEnableDoubleEncryption(enableDoubleEncryption);
        return this;
    }

    /**
     * Get the publicNetworkAccess property: Public network access to the cluster is enabled by default. When disabled,
     * only private endpoint connection to the cluster is allowed.
     *
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess();
    }

    /**
     * Set the publicNetworkAccess property: Public network access to the cluster is enabled by default. When disabled,
     * only private endpoint connection to the cluster is allowed.
     *
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withPublicNetworkAccess(publicNetworkAccess);
        return this;
    }

    /**
     * Get the allowedIpRangeList property: The list of ips in the format of CIDR allowed to connect to the cluster.
     *
     * @return the allowedIpRangeList value.
     */
    public List<String> allowedIpRangeList() {
        return this.innerProperties() == null ? null : this.innerProperties().allowedIpRangeList();
    }

    /**
     * Set the allowedIpRangeList property: The list of ips in the format of CIDR allowed to connect to the cluster.
     *
     * @param allowedIpRangeList the allowedIpRangeList value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withAllowedIpRangeList(List<String> allowedIpRangeList) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withAllowedIpRangeList(allowedIpRangeList);
        return this;
    }

    /**
     * Get the engineType property: The engine type.
     *
     * @return the engineType value.
     */
    public EngineType engineType() {
        return this.innerProperties() == null ? null : this.innerProperties().engineType();
    }

    /**
     * Set the engineType property: The engine type.
     *
     * @param engineType the engineType value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withEngineType(EngineType engineType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withEngineType(engineType);
        return this;
    }

    /**
     * Get the acceptedAudiences property: The cluster's accepted audiences.
     *
     * @return the acceptedAudiences value.
     */
    public List<AcceptedAudiences> acceptedAudiences() {
        return this.innerProperties() == null ? null : this.innerProperties().acceptedAudiences();
    }

    /**
     * Set the acceptedAudiences property: The cluster's accepted audiences.
     *
     * @param acceptedAudiences the acceptedAudiences value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withAcceptedAudiences(List<AcceptedAudiences> acceptedAudiences) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withAcceptedAudiences(acceptedAudiences);
        return this;
    }

    /**
     * Get the enableAutoStop property: A boolean value that indicates if the cluster could be automatically stopped
     * (due to lack of data or no activity for many days).
     *
     * @return the enableAutoStop value.
     */
    public Boolean enableAutoStop() {
        return this.innerProperties() == null ? null : this.innerProperties().enableAutoStop();
    }

    /**
     * Set the enableAutoStop property: A boolean value that indicates if the cluster could be automatically stopped
     * (due to lack of data or no activity for many days).
     *
     * @param enableAutoStop the enableAutoStop value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withEnableAutoStop(Boolean enableAutoStop) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withEnableAutoStop(enableAutoStop);
        return this;
    }

    /**
     * Get the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access. Value is
     * optional but if passed in, must be 'Enabled' or 'Disabled'.
     *
     * @return the restrictOutboundNetworkAccess value.
     */
    public ClusterNetworkAccessFlag restrictOutboundNetworkAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().restrictOutboundNetworkAccess();
    }

    /**
     * Set the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access. Value is
     * optional but if passed in, must be 'Enabled' or 'Disabled'.
     *
     * @param restrictOutboundNetworkAccess the restrictOutboundNetworkAccess value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withRestrictOutboundNetworkAccess(ClusterNetworkAccessFlag restrictOutboundNetworkAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withRestrictOutboundNetworkAccess(restrictOutboundNetworkAccess);
        return this;
    }

    /**
     * Get the allowedFqdnList property: List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster.
     *
     * @return the allowedFqdnList value.
     */
    public List<String> allowedFqdnList() {
        return this.innerProperties() == null ? null : this.innerProperties().allowedFqdnList();
    }

    /**
     * Set the allowedFqdnList property: List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster.
     *
     * @param allowedFqdnList the allowedFqdnList value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withAllowedFqdnList(List<String> allowedFqdnList) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withAllowedFqdnList(allowedFqdnList);
        return this;
    }

    /**
     * Get the publicIpType property: Indicates what public IP type to create - IPv4 (default), or DualStack (both IPv4
     * and IPv6).
     *
     * @return the publicIpType value.
     */
    public PublicIpType publicIpType() {
        return this.innerProperties() == null ? null : this.innerProperties().publicIpType();
    }

    /**
     * Set the publicIpType property: Indicates what public IP type to create - IPv4 (default), or DualStack (both IPv4
     * and IPv6).
     *
     * @param publicIpType the publicIpType value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withPublicIpType(PublicIpType publicIpType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withPublicIpType(publicIpType);
        return this;
    }

    /**
     * Get the virtualClusterGraduationProperties property: Virtual Cluster graduation properties.
     *
     * @return the virtualClusterGraduationProperties value.
     */
    public String virtualClusterGraduationProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().virtualClusterGraduationProperties();
    }

    /**
     * Set the virtualClusterGraduationProperties property: Virtual Cluster graduation properties.
     *
     * @param virtualClusterGraduationProperties the virtualClusterGraduationProperties value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withVirtualClusterGraduationProperties(String virtualClusterGraduationProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withVirtualClusterGraduationProperties(virtualClusterGraduationProperties);
        return this;
    }

    /**
     * Get the privateEndpointConnections property: A list of private endpoint connections.
     *
     * @return the privateEndpointConnections value.
     */
    public List<PrivateEndpointConnectionInner> privateEndpointConnections() {
        return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections();
    }

    /**
     * Get the migrationCluster property: Properties of the peer cluster involved in a migration to/from this cluster.
     *
     * @return the migrationCluster value.
     */
    public MigrationClusterProperties migrationCluster() {
        return this.innerProperties() == null ? null : this.innerProperties().migrationCluster();
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (sku() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property sku in model ClusterInner"));
        } else {
            sku().validate();
        }
        if (identity() != null) {
            identity().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

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