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

package com.azure.resourcemanager.automation.models;

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

/** The encryption settings for automation account. */
@Fluent
public final class EncryptionProperties {
    /*
     * Key vault properties.
     */
    @JsonProperty(value = "keyVaultProperties")
    private KeyVaultProperties keyVaultProperties;

    /*
     * Encryption Key Source
     */
    @JsonProperty(value = "keySource")
    private EncryptionKeySourceType keySource;

    /*
     * User identity used for CMK.
     */
    @JsonProperty(value = "identity")
    private EncryptionPropertiesIdentity identity;

    /**
     * Get the keyVaultProperties property: Key vault properties.
     *
     * @return the keyVaultProperties value.
     */
    public KeyVaultProperties keyVaultProperties() {
        return this.keyVaultProperties;
    }

    /**
     * Set the keyVaultProperties property: Key vault properties.
     *
     * @param keyVaultProperties the keyVaultProperties value to set.
     * @return the EncryptionProperties object itself.
     */
    public EncryptionProperties withKeyVaultProperties(KeyVaultProperties keyVaultProperties) {
        this.keyVaultProperties = keyVaultProperties;
        return this;
    }

    /**
     * Get the keySource property: Encryption Key Source.
     *
     * @return the keySource value.
     */
    public EncryptionKeySourceType keySource() {
        return this.keySource;
    }

    /**
     * Set the keySource property: Encryption Key Source.
     *
     * @param keySource the keySource value to set.
     * @return the EncryptionProperties object itself.
     */
    public EncryptionProperties withKeySource(EncryptionKeySourceType keySource) {
        this.keySource = keySource;
        return this;
    }

    /**
     * Get the identity property: User identity used for CMK.
     *
     * @return the identity value.
     */
    public EncryptionPropertiesIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: User identity used for CMK.
     *
     * @param identity the identity value to set.
     * @return the EncryptionProperties object itself.
     */
    public EncryptionProperties withIdentity(EncryptionPropertiesIdentity identity) {
        this.identity = identity;
        return this;
    }

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