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

package com.azure.resourcemanager.databricks.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The object that contains details of encryption used on the workspace. */
@Fluent
public final class EncryptionV2 {
    /*
     * The encryption keySource (provider). Possible values (case-insensitive):  Microsoft.Keyvault
     */
    @JsonProperty(value = "keySource", required = true)
    private EncryptionKeySource keySource;

    /*
     * Key Vault input properties for encryption.
     */
    @JsonProperty(value = "keyVaultProperties")
    private EncryptionV2KeyVaultProperties keyVaultProperties;

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

    /**
     * Get the keySource property: The encryption keySource (provider). Possible values (case-insensitive):
     * Microsoft.Keyvault.
     *
     * @return the keySource value.
     */
    public EncryptionKeySource keySource() {
        return this.keySource;
    }

    /**
     * Set the keySource property: The encryption keySource (provider). Possible values (case-insensitive):
     * Microsoft.Keyvault.
     *
     * @param keySource the keySource value to set.
     * @return the EncryptionV2 object itself.
     */
    public EncryptionV2 withKeySource(EncryptionKeySource keySource) {
        this.keySource = keySource;
        return this;
    }

    /**
     * Get the keyVaultProperties property: Key Vault input properties for encryption.
     *
     * @return the keyVaultProperties value.
     */
    public EncryptionV2KeyVaultProperties keyVaultProperties() {
        return this.keyVaultProperties;
    }

    /**
     * Set the keyVaultProperties property: Key Vault input properties for encryption.
     *
     * @param keyVaultProperties the keyVaultProperties value to set.
     * @return the EncryptionV2 object itself.
     */
    public EncryptionV2 withKeyVaultProperties(EncryptionV2KeyVaultProperties keyVaultProperties) {
        this.keyVaultProperties = keyVaultProperties;
        return this;
    }

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

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