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

package com.azure.resourcemanager.storagecache.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Cache encryption settings. */
@Fluent
public final class CacheEncryptionSettings {
    /*
     * Specifies the location of the key encryption key in key vault.
     */
    @JsonProperty(value = "keyEncryptionKey")
    private KeyVaultKeyReference keyEncryptionKey;

    /*
     * Specifies whether the service will automatically rotate to the newest version of the key in the key vault.
     */
    @JsonProperty(value = "rotationToLatestKeyVersionEnabled")
    private Boolean rotationToLatestKeyVersionEnabled;

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

    /**
     * Get the keyEncryptionKey property: Specifies the location of the key encryption key in key vault.
     *
     * @return the keyEncryptionKey value.
     */
    public KeyVaultKeyReference keyEncryptionKey() {
        return this.keyEncryptionKey;
    }

    /**
     * Set the keyEncryptionKey property: Specifies the location of the key encryption key in key vault.
     *
     * @param keyEncryptionKey the keyEncryptionKey value to set.
     * @return the CacheEncryptionSettings object itself.
     */
    public CacheEncryptionSettings withKeyEncryptionKey(KeyVaultKeyReference keyEncryptionKey) {
        this.keyEncryptionKey = keyEncryptionKey;
        return this;
    }

    /**
     * Get the rotationToLatestKeyVersionEnabled property: Specifies whether the service will automatically rotate to
     * the newest version of the key in the key vault.
     *
     * @return the rotationToLatestKeyVersionEnabled value.
     */
    public Boolean rotationToLatestKeyVersionEnabled() {
        return this.rotationToLatestKeyVersionEnabled;
    }

    /**
     * Set the rotationToLatestKeyVersionEnabled property: Specifies whether the service will automatically rotate to
     * the newest version of the key in the key vault.
     *
     * @param rotationToLatestKeyVersionEnabled the rotationToLatestKeyVersionEnabled value to set.
     * @return the CacheEncryptionSettings object itself.
     */
    public CacheEncryptionSettings withRotationToLatestKeyVersionEnabled(Boolean rotationToLatestKeyVersionEnabled) {
        this.rotationToLatestKeyVersionEnabled = rotationToLatestKeyVersionEnabled;
        return this;
    }

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