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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.resourcemanager.apimanagement.models.AlwaysLog;
import com.azure.resourcemanager.apimanagement.models.HttpCorrelationProtocol;
import com.azure.resourcemanager.apimanagement.models.OperationNameFormat;
import com.azure.resourcemanager.apimanagement.models.PipelineDiagnosticSettings;
import com.azure.resourcemanager.apimanagement.models.SamplingSettings;
import com.azure.resourcemanager.apimanagement.models.Verbosity;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Diagnostic details. */
@Fluent
public final class DiagnosticContractInner extends ProxyResource {
    /*
     * Diagnostic entity contract properties.
     */
    @JsonProperty(value = "properties")
    private DiagnosticContractProperties innerProperties;

    /**
     * Get the innerProperties property: Diagnostic entity contract properties.
     *
     * @return the innerProperties value.
     */
    private DiagnosticContractProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the alwaysLog property: Specifies for what type of messages sampling settings should not apply.
     *
     * @return the alwaysLog value.
     */
    public AlwaysLog alwaysLog() {
        return this.innerProperties() == null ? null : this.innerProperties().alwaysLog();
    }

    /**
     * Set the alwaysLog property: Specifies for what type of messages sampling settings should not apply.
     *
     * @param alwaysLog the alwaysLog value to set.
     * @return the DiagnosticContractInner object itself.
     */
    public DiagnosticContractInner withAlwaysLog(AlwaysLog alwaysLog) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticContractProperties();
        }
        this.innerProperties().withAlwaysLog(alwaysLog);
        return this;
    }

    /**
     * Get the loggerId property: Resource Id of a target logger.
     *
     * @return the loggerId value.
     */
    public String loggerId() {
        return this.innerProperties() == null ? null : this.innerProperties().loggerId();
    }

    /**
     * Set the loggerId property: Resource Id of a target logger.
     *
     * @param loggerId the loggerId value to set.
     * @return the DiagnosticContractInner object itself.
     */
    public DiagnosticContractInner withLoggerId(String loggerId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticContractProperties();
        }
        this.innerProperties().withLoggerId(loggerId);
        return this;
    }

    /**
     * Get the sampling property: Sampling settings for Diagnostic.
     *
     * @return the sampling value.
     */
    public SamplingSettings sampling() {
        return this.innerProperties() == null ? null : this.innerProperties().sampling();
    }

    /**
     * Set the sampling property: Sampling settings for Diagnostic.
     *
     * @param sampling the sampling value to set.
     * @return the DiagnosticContractInner object itself.
     */
    public DiagnosticContractInner withSampling(SamplingSettings sampling) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticContractProperties();
        }
        this.innerProperties().withSampling(sampling);
        return this;
    }

    /**
     * Get the frontend property: Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.
     *
     * @return the frontend value.
     */
    public PipelineDiagnosticSettings frontend() {
        return this.innerProperties() == null ? null : this.innerProperties().frontend();
    }

    /**
     * Set the frontend property: Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.
     *
     * @param frontend the frontend value to set.
     * @return the DiagnosticContractInner object itself.
     */
    public DiagnosticContractInner withFrontend(PipelineDiagnosticSettings frontend) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticContractProperties();
        }
        this.innerProperties().withFrontend(frontend);
        return this;
    }

    /**
     * Get the backend property: Diagnostic settings for incoming/outgoing HTTP messages to the Backend.
     *
     * @return the backend value.
     */
    public PipelineDiagnosticSettings backend() {
        return this.innerProperties() == null ? null : this.innerProperties().backend();
    }

    /**
     * Set the backend property: Diagnostic settings for incoming/outgoing HTTP messages to the Backend.
     *
     * @param backend the backend value to set.
     * @return the DiagnosticContractInner object itself.
     */
    public DiagnosticContractInner withBackend(PipelineDiagnosticSettings backend) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticContractProperties();
        }
        this.innerProperties().withBackend(backend);
        return this;
    }

    /**
     * Get the logClientIp property: Log the ClientIP. Default is false.
     *
     * @return the logClientIp value.
     */
    public Boolean logClientIp() {
        return this.innerProperties() == null ? null : this.innerProperties().logClientIp();
    }

    /**
     * Set the logClientIp property: Log the ClientIP. Default is false.
     *
     * @param logClientIp the logClientIp value to set.
     * @return the DiagnosticContractInner object itself.
     */
    public DiagnosticContractInner withLogClientIp(Boolean logClientIp) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticContractProperties();
        }
        this.innerProperties().withLogClientIp(logClientIp);
        return this;
    }

    /**
     * Get the httpCorrelationProtocol property: Sets correlation protocol to use for Application Insights diagnostics.
     *
     * @return the httpCorrelationProtocol value.
     */
    public HttpCorrelationProtocol httpCorrelationProtocol() {
        return this.innerProperties() == null ? null : this.innerProperties().httpCorrelationProtocol();
    }

    /**
     * Set the httpCorrelationProtocol property: Sets correlation protocol to use for Application Insights diagnostics.
     *
     * @param httpCorrelationProtocol the httpCorrelationProtocol value to set.
     * @return the DiagnosticContractInner object itself.
     */
    public DiagnosticContractInner withHttpCorrelationProtocol(HttpCorrelationProtocol httpCorrelationProtocol) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticContractProperties();
        }
        this.innerProperties().withHttpCorrelationProtocol(httpCorrelationProtocol);
        return this;
    }

    /**
     * Get the verbosity property: The verbosity level applied to traces emitted by trace policies.
     *
     * @return the verbosity value.
     */
    public Verbosity verbosity() {
        return this.innerProperties() == null ? null : this.innerProperties().verbosity();
    }

    /**
     * Set the verbosity property: The verbosity level applied to traces emitted by trace policies.
     *
     * @param verbosity the verbosity value to set.
     * @return the DiagnosticContractInner object itself.
     */
    public DiagnosticContractInner withVerbosity(Verbosity verbosity) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticContractProperties();
        }
        this.innerProperties().withVerbosity(verbosity);
        return this;
    }

    /**
     * Get the operationNameFormat property: The format of the Operation Name for Application Insights telemetries.
     * Default is Name.
     *
     * @return the operationNameFormat value.
     */
    public OperationNameFormat operationNameFormat() {
        return this.innerProperties() == null ? null : this.innerProperties().operationNameFormat();
    }

    /**
     * Set the operationNameFormat property: The format of the Operation Name for Application Insights telemetries.
     * Default is Name.
     *
     * @param operationNameFormat the operationNameFormat value to set.
     * @return the DiagnosticContractInner object itself.
     */
    public DiagnosticContractInner withOperationNameFormat(OperationNameFormat operationNameFormat) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticContractProperties();
        }
        this.innerProperties().withOperationNameFormat(operationNameFormat);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}
