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

package com.azure.resourcemanager.network.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.SubResource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.network.fluent.models.P2SVpnServerConfigVpnClientRootCertificatePropertiesFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/** VPN client root certificate of P2SVpnServerConfiguration. */
@Fluent
public final class P2SVpnServerConfigVpnClientRootCertificate extends SubResource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(P2SVpnServerConfigVpnClientRootCertificate.class);

    /*
     * Properties of the P2SVpnServerConfiguration VPN client root certificate.
     */
    @JsonProperty(value = "properties", required = true)
    private P2SVpnServerConfigVpnClientRootCertificatePropertiesFormat innerProperties =
        new P2SVpnServerConfigVpnClientRootCertificatePropertiesFormat();

    /*
     * The name of the resource that is unique within a resource group. This
     * name can be used to access the resource.
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * A unique read-only string that changes whenever the resource is updated.
     */
    @JsonProperty(value = "etag")
    private String etag;

    /**
     * Get the innerProperties property: Properties of the P2SVpnServerConfiguration VPN client root certificate.
     *
     * @return the innerProperties value.
     */
    private P2SVpnServerConfigVpnClientRootCertificatePropertiesFormat innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the name property: The name of the resource that is unique within a resource group. This name can be used to
     * access the resource.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: The name of the resource that is unique within a resource group. This name can be used to
     * access the resource.
     *
     * @param name the name value to set.
     * @return the P2SVpnServerConfigVpnClientRootCertificate object itself.
     */
    public P2SVpnServerConfigVpnClientRootCertificate withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the etag property: A unique read-only string that changes whenever the resource is updated.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Set the etag property: A unique read-only string that changes whenever the resource is updated.
     *
     * @param etag the etag value to set.
     * @return the P2SVpnServerConfigVpnClientRootCertificate object itself.
     */
    public P2SVpnServerConfigVpnClientRootCertificate withEtag(String etag) {
        this.etag = etag;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public P2SVpnServerConfigVpnClientRootCertificate withId(String id) {
        super.withId(id);
        return this;
    }

    /**
     * Get the publicCertData property: The certificate public data.
     *
     * @return the publicCertData value.
     */
    public String publicCertData() {
        return this.innerProperties() == null ? null : this.innerProperties().publicCertData();
    }

    /**
     * Set the publicCertData property: The certificate public data.
     *
     * @param publicCertData the publicCertData value to set.
     * @return the P2SVpnServerConfigVpnClientRootCertificate object itself.
     */
    public P2SVpnServerConfigVpnClientRootCertificate withPublicCertData(String publicCertData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new P2SVpnServerConfigVpnClientRootCertificatePropertiesFormat();
        }
        this.innerProperties().withPublicCertData(publicCertData);
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning state of the P2SVpnServerConfiguration VPN client root
     * certificate resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * 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"
                            + " P2SVpnServerConfigVpnClientRootCertificate"));
        } else {
            innerProperties().validate();
        }
    }
}
