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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.redisenterprise.models.ClusterPropertiesEncryption;
import com.azure.resourcemanager.redisenterprise.models.ProvisioningState;
import com.azure.resourcemanager.redisenterprise.models.ResourceState;
import com.azure.resourcemanager.redisenterprise.models.TlsVersion;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/**
 * RedisEnterprise cluster properties
 *
 * <p>Properties of RedisEnterprise clusters, as opposed to general resource properties like location, tags.
 */
@Fluent
public final class ClusterProperties {
    /*
     * The minimum TLS version for the cluster to support, e.g. '1.2'
     */
    @JsonProperty(value = "minimumTlsVersion")
    private TlsVersion minimumTlsVersion;

    /*
     * Encryption-at-rest configuration for the cluster.
     */
    @JsonProperty(value = "encryption")
    private ClusterPropertiesEncryption encryption;

    /*
     * DNS name of the cluster endpoint
     */
    @JsonProperty(value = "hostName", access = JsonProperty.Access.WRITE_ONLY)
    private String hostname;

    /*
     * Current provisioning status of the cluster
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * Current resource status of the cluster
     */
    @JsonProperty(value = "resourceState", access = JsonProperty.Access.WRITE_ONLY)
    private ResourceState resourceState;

    /*
     * Version of redis the cluster supports, e.g. '6'
     */
    @JsonProperty(value = "redisVersion", access = JsonProperty.Access.WRITE_ONLY)
    private String redisVersion;

    /*
     * List of private endpoint connections associated with the specified RedisEnterprise cluster
     */
    @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY)
    private List<PrivateEndpointConnectionInner> privateEndpointConnections;

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

    /**
     * Get the minimumTlsVersion property: The minimum TLS version for the cluster to support, e.g. '1.2'.
     *
     * @return the minimumTlsVersion value.
     */
    public TlsVersion minimumTlsVersion() {
        return this.minimumTlsVersion;
    }

    /**
     * Set the minimumTlsVersion property: The minimum TLS version for the cluster to support, e.g. '1.2'.
     *
     * @param minimumTlsVersion the minimumTlsVersion value to set.
     * @return the ClusterProperties object itself.
     */
    public ClusterProperties withMinimumTlsVersion(TlsVersion minimumTlsVersion) {
        this.minimumTlsVersion = minimumTlsVersion;
        return this;
    }

    /**
     * Get the encryption property: Encryption-at-rest configuration for the cluster.
     *
     * @return the encryption value.
     */
    public ClusterPropertiesEncryption encryption() {
        return this.encryption;
    }

    /**
     * Set the encryption property: Encryption-at-rest configuration for the cluster.
     *
     * @param encryption the encryption value to set.
     * @return the ClusterProperties object itself.
     */
    public ClusterProperties withEncryption(ClusterPropertiesEncryption encryption) {
        this.encryption = encryption;
        return this;
    }

    /**
     * Get the hostname property: DNS name of the cluster endpoint.
     *
     * @return the hostname value.
     */
    public String hostname() {
        return this.hostname;
    }

    /**
     * Get the provisioningState property: Current provisioning status of the cluster.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the resourceState property: Current resource status of the cluster.
     *
     * @return the resourceState value.
     */
    public ResourceState resourceState() {
        return this.resourceState;
    }

    /**
     * Get the redisVersion property: Version of redis the cluster supports, e.g. '6'.
     *
     * @return the redisVersion value.
     */
    public String redisVersion() {
        return this.redisVersion;
    }

    /**
     * Get the privateEndpointConnections property: List of private endpoint connections associated with the specified
     * RedisEnterprise cluster.
     *
     * @return the privateEndpointConnections value.
     */
    public List<PrivateEndpointConnectionInner> privateEndpointConnections() {
        return this.privateEndpointConnections;
    }

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