// 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;

/** The kubernetes ingress configuration to control access to packet core diagnostics over local APIs. */
@Fluent
public final class LocalDiagnosticsAccessConfiguration {
    /*
     * How to authenticate users who access local diagnostics APIs.
     */
    @JsonProperty(value = "authenticationType", required = true)
    private AuthenticationType authenticationType;

    /*
     * The HTTPS server TLS certificate used to secure local access to diagnostics.
     */
    @JsonProperty(value = "httpsServerCertificate")
    private HttpsServerCertificate httpsServerCertificate;

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

    /**
     * Get the authenticationType property: How to authenticate users who access local diagnostics APIs.
     *
     * @return the authenticationType value.
     */
    public AuthenticationType authenticationType() {
        return this.authenticationType;
    }

    /**
     * Set the authenticationType property: How to authenticate users who access local diagnostics APIs.
     *
     * @param authenticationType the authenticationType value to set.
     * @return the LocalDiagnosticsAccessConfiguration object itself.
     */
    public LocalDiagnosticsAccessConfiguration withAuthenticationType(AuthenticationType authenticationType) {
        this.authenticationType = authenticationType;
        return this;
    }

    /**
     * Get the httpsServerCertificate property: The HTTPS server TLS certificate used to secure local access to
     * diagnostics.
     *
     * @return the httpsServerCertificate value.
     */
    public HttpsServerCertificate httpsServerCertificate() {
        return this.httpsServerCertificate;
    }

    /**
     * Set the httpsServerCertificate property: The HTTPS server TLS certificate used to secure local access to
     * diagnostics.
     *
     * @param httpsServerCertificate the httpsServerCertificate value to set.
     * @return the LocalDiagnosticsAccessConfiguration object itself.
     */
    public LocalDiagnosticsAccessConfiguration withHttpsServerCertificate(
        HttpsServerCertificate httpsServerCertificate) {
        this.httpsServerCertificate = httpsServerCertificate;
        return this;
    }

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

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