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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.resourcemanager.kusto.fluent.models.ClusterProperties;
import com.azure.resourcemanager.kusto.fluent.models.PrivateEndpointConnectionInner;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Class representing an update to a Kusto cluster. */
@Fluent
public final class ClusterUpdate extends ProxyResource {
    /*
     * Resource tags.
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

    /*
     * Resource location.
     */
    @JsonProperty(value = "location")
    private String location;

    /*
     * The SKU of the cluster.
     */
    @JsonProperty(value = "sku")
    private AzureSku sku;

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

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

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

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

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

    /**
     * Get the location property: Resource location.
     *
     * @return the location value.
     */
    public String location() {
        return this.location;
    }

    /**
     * Set the location property: Resource location.
     *
     * @param location the location value to set.
     * @return the ClusterUpdate object itself.
     */
    public ClusterUpdate withLocation(String location) {
        this.location = location;
        return this;
    }

    /**
     * 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 ClusterUpdate object itself.
     */
    public ClusterUpdate withSku(AzureSku sku) {
        this.sku = sku;
        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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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 ClusterUpdate object itself.
     */
    public ClusterUpdate 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();
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (sku() != null) {
            sku().validate();
        }
        if (identity() != null) {
            identity().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}
