// <auto-generated/>

#nullable disable

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

namespace Sample
{
    /// <summary> TestClient description. </summary>
    public partial class TestClient
    {
        private readonly global::System.Uri _endpoint;
        private readonly string _queryParam;

        /// <summary> Initializes a new instance of TestClient for mocking. </summary>
        protected TestClient()
        {
        }

        /// <summary> Initializes a new instance of TestClient. </summary>
        /// <param name="endpoint"> Service endpoint. </param>
        /// <param name="queryParam"> queryParam description. </param>
        /// <exception cref="global::System.ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="queryParam"/> is null. </exception>
        /// <exception cref="global::System.ArgumentException"> <paramref name="queryParam"/> is an empty string, and was expected to be non-empty. </exception>
        public TestClient(global::System.Uri endpoint, string queryParam) : this(endpoint, queryParam, new global::Sample.TestClientOptions())
        {
        }

        /// <summary> Initializes a new instance of TestClient. </summary>
        /// <param name="endpoint"> Service endpoint. </param>
        /// <param name="queryParam"> queryParam description. </param>
        /// <param name="options"> The options for configuring the client. </param>
        /// <exception cref="global::System.ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="queryParam"/> is null. </exception>
        /// <exception cref="global::System.ArgumentException"> <paramref name="queryParam"/> is an empty string, and was expected to be non-empty. </exception>
        public TestClient(global::System.Uri endpoint, string queryParam, global::Sample.TestClientOptions options)
        {
            global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint));
            global::Sample.Argument.AssertNotNullOrEmpty(queryParam, nameof(queryParam));

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

            _endpoint = endpoint;
            _queryParam = queryParam;
            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>());
        }

        /// <summary> The HTTP pipeline for sending and receiving REST requests and responses. </summary>
        public global::System.ClientModel.Primitives.ClientPipeline Pipeline { get; }

        /// <summary>
        /// [Protocol Method] Foo description
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="global::System.ClientModel.ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual global::System.ClientModel.ClientResult Foo(global::System.ClientModel.Primitives.RequestOptions options)
        {
            using global::System.ClientModel.Primitives.PipelineMessage message = this.CreateFooRequest(options);
            return global::System.ClientModel.ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
        }

        /// <summary>
        /// [Protocol Method] Foo description
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="global::System.ClientModel.ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async global::System.Threading.Tasks.Task<global::System.ClientModel.ClientResult> FooAsync(global::System.ClientModel.Primitives.RequestOptions options)
        {
            using global::System.ClientModel.Primitives.PipelineMessage message = this.CreateFooRequest(options);
            return global::System.ClientModel.ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
        }

        /// <summary> Foo description. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="global::System.ClientModel.ClientResultException"> Service returned a non-success status code. </exception>
        public virtual global::System.ClientModel.ClientResult Foo(global::System.Threading.CancellationToken cancellationToken = default)
        {
            return this.Foo(cancellationToken.ToRequestOptions());
        }

        /// <summary> Foo description. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="global::System.ClientModel.ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async global::System.Threading.Tasks.Task<global::System.ClientModel.ClientResult> FooAsync(global::System.Threading.CancellationToken cancellationToken = default)
        {
            return await this.FooAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false);
        }
    }
}
