// <auto-generated/>

#nullable disable

using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Threading;
using System.Threading.Tasks;

namespace Sample
{
    public partial class TestClient
    {
        private readonly global::System.Uri _endpoint;
        private readonly string _serviceAApiVersion;
        private readonly string _serviceBApiVersion;

        protected TestClient()
        {
        }

        public TestClient(global::System.Uri endpoint) : this(endpoint, new global::Sample.TestClientOptions())
        {
        }

        internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, global::Sample.TestClientOptions options)
        {
            global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint));

            options ??= new global::Sample.TestClientOptions();

            _endpoint = endpoint;
            if ((authenticationPolicy != null))
            {
                Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty<global::System.ClientModel.Primitives.PipelinePolicy>(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), authenticationPolicy }, Array.Empty<global::System.ClientModel.Primitives.PipelinePolicy>());
            }
            else
            {
                Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty<global::System.ClientModel.Primitives.PipelinePolicy>(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty<global::System.ClientModel.Primitives.PipelinePolicy>());
            }
            _serviceAApiVersion = options.ServiceAApiVersion;
            _serviceBApiVersion = options.ServiceBApiVersion;
        }

        public TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions options) : this(null, endpoint, options)
        {
        }

        public global::System.ClientModel.Primitives.ClientPipeline Pipeline { get; }

        public virtual global::System.ClientModel.ClientResult ServiceAOperation(global::System.ClientModel.Primitives.RequestOptions options)
        {
            using global::System.ClientModel.Primitives.PipelineMessage message = this.CreateServiceAOperationRequest(options);
            return global::System.ClientModel.ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
        }

        public virtual async global::System.Threading.Tasks.Task<global::System.ClientModel.ClientResult> ServiceAOperationAsync(global::System.ClientModel.Primitives.RequestOptions options)
        {
            using global::System.ClientModel.Primitives.PipelineMessage message = this.CreateServiceAOperationRequest(options);
            return global::System.ClientModel.ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
        }

        public virtual global::System.ClientModel.ClientResult ServiceAOperation(global::System.Threading.CancellationToken cancellationToken = default)
        {
            return this.ServiceAOperation(cancellationToken.ToRequestOptions());
        }

        public virtual async global::System.Threading.Tasks.Task<global::System.ClientModel.ClientResult> ServiceAOperationAsync(global::System.Threading.CancellationToken cancellationToken = default)
        {
            return await this.ServiceAOperationAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false);
        }

        public virtual global::System.ClientModel.ClientResult ServiceBOperation(global::System.ClientModel.Primitives.RequestOptions options)
        {
            using global::System.ClientModel.Primitives.PipelineMessage message = this.CreateServiceBOperationRequest(options);
            return global::System.ClientModel.ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
        }

        public virtual async global::System.Threading.Tasks.Task<global::System.ClientModel.ClientResult> ServiceBOperationAsync(global::System.ClientModel.Primitives.RequestOptions options)
        {
            using global::System.ClientModel.Primitives.PipelineMessage message = this.CreateServiceBOperationRequest(options);
            return global::System.ClientModel.ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
        }

        public virtual global::System.ClientModel.ClientResult ServiceBOperation(global::System.Threading.CancellationToken cancellationToken = default)
        {
            return this.ServiceBOperation(cancellationToken.ToRequestOptions());
        }

        public virtual async global::System.Threading.Tasks.Task<global::System.ClientModel.ClientResult> ServiceBOperationAsync(global::System.Threading.CancellationToken cancellationToken = default)
        {
            return await this.ServiceBOperationAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false);
        }
    }
}
