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

package com.azure.resourcemanager.batchai.models;

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

/** Key Vault Secret reference. */
@Fluent
public final class KeyVaultSecretReference {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultSecretReference.class);

    /*
     * Fully qualified resource identifier of the Key Vault.
     */
    @JsonProperty(value = "sourceVault", required = true)
    private ResourceId sourceVault;

    /*
     * The URL referencing a secret in the Key Vault.
     */
    @JsonProperty(value = "secretUrl", required = true)
    private String secretUrl;

    /**
     * Get the sourceVault property: Fully qualified resource identifier of the Key Vault.
     *
     * @return the sourceVault value.
     */
    public ResourceId sourceVault() {
        return this.sourceVault;
    }

    /**
     * Set the sourceVault property: Fully qualified resource identifier of the Key Vault.
     *
     * @param sourceVault the sourceVault value to set.
     * @return the KeyVaultSecretReference object itself.
     */
    public KeyVaultSecretReference withSourceVault(ResourceId sourceVault) {
        this.sourceVault = sourceVault;
        return this;
    }

    /**
     * Get the secretUrl property: The URL referencing a secret in the Key Vault.
     *
     * @return the secretUrl value.
     */
    public String secretUrl() {
        return this.secretUrl;
    }

    /**
     * Set the secretUrl property: The URL referencing a secret in the Key Vault.
     *
     * @param secretUrl the secretUrl value to set.
     * @return the KeyVaultSecretReference object itself.
     */
    public KeyVaultSecretReference withSecretUrl(String secretUrl) {
        this.secretUrl = secretUrl;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (sourceVault() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property sourceVault in model KeyVaultSecretReference"));
        } else {
            sourceVault().validate();
        }
        if (secretUrl() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property secretUrl in model KeyVaultSecretReference"));
        }
    }
}
