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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.signalr.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** A custom certificate. */
@Fluent
public final class CustomCertificateInner extends ProxyResource {
    /*
     * Metadata pertaining to creation and last modification of the resource.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * Custom certificate properties.
     */
    @JsonProperty(value = "properties", required = true)
    private CustomCertificateProperties innerProperties = new CustomCertificateProperties();

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

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the resource.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the innerProperties property: Custom certificate properties.
     *
     * @return the innerProperties value.
     */
    private CustomCertificateProperties innerProperties() {
        return this.innerProperties;
    }

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

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

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

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

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

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

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

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

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