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

package com.azure.resourcemanager.webpubsub.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.webpubsub.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Custom certificate properties. */
@Fluent
public final class CustomCertificateProperties {
    /*
     * Provisioning state of the resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * Base uri of the KeyVault that stores certificate.
     */
    @JsonProperty(value = "keyVaultBaseUri", required = true)
    private String keyVaultBaseUri;

    /*
     * Certificate secret name.
     */
    @JsonProperty(value = "keyVaultSecretName", required = true)
    private String keyVaultSecretName;

    /*
     * Certificate secret version.
     */
    @JsonProperty(value = "keyVaultSecretVersion")
    private String keyVaultSecretVersion;

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

    /**
     * Get the provisioningState property: Provisioning state of the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the keyVaultBaseUri property: Base uri of the KeyVault that stores certificate.
     *
     * @return the keyVaultBaseUri value.
     */
    public String keyVaultBaseUri() {
        return this.keyVaultBaseUri;
    }

    /**
     * Set the keyVaultBaseUri property: Base uri of the KeyVault that stores certificate.
     *
     * @param keyVaultBaseUri the keyVaultBaseUri value to set.
     * @return the CustomCertificateProperties object itself.
     */
    public CustomCertificateProperties withKeyVaultBaseUri(String keyVaultBaseUri) {
        this.keyVaultBaseUri = keyVaultBaseUri;
        return this;
    }

    /**
     * Get the keyVaultSecretName property: Certificate secret name.
     *
     * @return the keyVaultSecretName value.
     */
    public String keyVaultSecretName() {
        return this.keyVaultSecretName;
    }

    /**
     * Set the keyVaultSecretName property: Certificate secret name.
     *
     * @param keyVaultSecretName the keyVaultSecretName value to set.
     * @return the CustomCertificateProperties object itself.
     */
    public CustomCertificateProperties withKeyVaultSecretName(String keyVaultSecretName) {
        this.keyVaultSecretName = keyVaultSecretName;
        return this;
    }

    /**
     * Get the keyVaultSecretVersion property: Certificate secret version.
     *
     * @return the keyVaultSecretVersion value.
     */
    public String keyVaultSecretVersion() {
        return this.keyVaultSecretVersion;
    }

    /**
     * Set the keyVaultSecretVersion property: Certificate secret version.
     *
     * @param keyVaultSecretVersion the keyVaultSecretVersion value to set.
     * @return the CustomCertificateProperties object itself.
     */
    public CustomCertificateProperties withKeyVaultSecretVersion(String keyVaultSecretVersion) {
        this.keyVaultSecretVersion = keyVaultSecretVersion;
        return this;
    }

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

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