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

package com.azure.resourcemanager.mobilenetwork.models;

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

/** HTTPS server certificate configuration. */
@Fluent
public final class HttpsServerCertificate {
    /*
     * The certificate URL, unversioned. For example: https://contosovault.vault.azure.net/certificates/ingress.
     */
    @JsonProperty(value = "certificateUrl", required = true)
    private String certificateUrl;

    /*
     * The provisioning state of the certificate.
     */
    @JsonProperty(value = "provisioning", access = JsonProperty.Access.WRITE_ONLY)
    private CertificateProvisioning provisioning;

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

    /**
     * Get the certificateUrl property: The certificate URL, unversioned. For example:
     * https://contosovault.vault.azure.net/certificates/ingress.
     *
     * @return the certificateUrl value.
     */
    public String certificateUrl() {
        return this.certificateUrl;
    }

    /**
     * Set the certificateUrl property: The certificate URL, unversioned. For example:
     * https://contosovault.vault.azure.net/certificates/ingress.
     *
     * @param certificateUrl the certificateUrl value to set.
     * @return the HttpsServerCertificate object itself.
     */
    public HttpsServerCertificate withCertificateUrl(String certificateUrl) {
        this.certificateUrl = certificateUrl;
        return this;
    }

    /**
     * Get the provisioning property: The provisioning state of the certificate.
     *
     * @return the provisioning value.
     */
    public CertificateProvisioning provisioning() {
        return this.provisioning;
    }

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

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