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

package com.azure.resourcemanager.datalakestore.models;

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

/** The encryption configuration for the account. */
@Fluent
public final class EncryptionConfig {
    /*
     * The type of encryption configuration being used. Currently the only supported types are 'UserManaged' and
     * 'ServiceManaged'.
     */
    @JsonProperty(value = "type", required = true)
    private EncryptionConfigType type;

    /*
     * The Key Vault information for connecting to user managed encryption keys.
     */
    @JsonProperty(value = "keyVaultMetaInfo")
    private KeyVaultMetaInfo keyVaultMetaInfo;

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

    /**
     * Get the type property: The type of encryption configuration being used. Currently the only supported types are
     * 'UserManaged' and 'ServiceManaged'.
     *
     * @return the type value.
     */
    public EncryptionConfigType type() {
        return this.type;
    }

    /**
     * Set the type property: The type of encryption configuration being used. Currently the only supported types are
     * 'UserManaged' and 'ServiceManaged'.
     *
     * @param type the type value to set.
     * @return the EncryptionConfig object itself.
     */
    public EncryptionConfig withType(EncryptionConfigType type) {
        this.type = type;
        return this;
    }

    /**
     * Get the keyVaultMetaInfo property: The Key Vault information for connecting to user managed encryption keys.
     *
     * @return the keyVaultMetaInfo value.
     */
    public KeyVaultMetaInfo keyVaultMetaInfo() {
        return this.keyVaultMetaInfo;
    }

    /**
     * Set the keyVaultMetaInfo property: The Key Vault information for connecting to user managed encryption keys.
     *
     * @param keyVaultMetaInfo the keyVaultMetaInfo value to set.
     * @return the EncryptionConfig object itself.
     */
    public EncryptionConfig withKeyVaultMetaInfo(KeyVaultMetaInfo keyVaultMetaInfo) {
        this.keyVaultMetaInfo = keyVaultMetaInfo;
        return this;
    }

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

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