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

package com.azure.resourcemanager.videoanalyzer.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
 * TLS endpoint describes an endpoint that the pipeline can connect to over TLS transport (data is encrypted in
 * transit).
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type")
@JsonTypeName("#Microsoft.VideoAnalyzer.TlsEndpoint")
@Fluent
public final class TlsEndpoint extends EndpointBase {
    /*
     * List of trusted certificate authorities when authenticating a TLS
     * connection. A null list designates that Azure Video Analyzer's list of
     * trusted authorities should be used.
     */
    @JsonProperty(value = "trustedCertificates")
    private CertificateSource trustedCertificates;

    /*
     * Validation options to use when authenticating a TLS connection. By
     * default, strict validation is used.
     */
    @JsonProperty(value = "validationOptions")
    private TlsValidationOptions validationOptions;

    /**
     * Get the trustedCertificates property: List of trusted certificate authorities when authenticating a TLS
     * connection. A null list designates that Azure Video Analyzer's list of trusted authorities should be used.
     *
     * @return the trustedCertificates value.
     */
    public CertificateSource trustedCertificates() {
        return this.trustedCertificates;
    }

    /**
     * Set the trustedCertificates property: List of trusted certificate authorities when authenticating a TLS
     * connection. A null list designates that Azure Video Analyzer's list of trusted authorities should be used.
     *
     * @param trustedCertificates the trustedCertificates value to set.
     * @return the TlsEndpoint object itself.
     */
    public TlsEndpoint withTrustedCertificates(CertificateSource trustedCertificates) {
        this.trustedCertificates = trustedCertificates;
        return this;
    }

    /**
     * Get the validationOptions property: Validation options to use when authenticating a TLS connection. By default,
     * strict validation is used.
     *
     * @return the validationOptions value.
     */
    public TlsValidationOptions validationOptions() {
        return this.validationOptions;
    }

    /**
     * Set the validationOptions property: Validation options to use when authenticating a TLS connection. By default,
     * strict validation is used.
     *
     * @param validationOptions the validationOptions value to set.
     * @return the TlsEndpoint object itself.
     */
    public TlsEndpoint withValidationOptions(TlsValidationOptions validationOptions) {
        this.validationOptions = validationOptions;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public TlsEndpoint withCredentials(CredentialsBase credentials) {
        super.withCredentials(credentials);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public TlsEndpoint withUrl(String url) {
        super.withUrl(url);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public TlsEndpoint withTunnel(TunnelBase tunnel) {
        super.withTunnel(tunnel);
        return this;
    }

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