namespace Microsoft.Graph
{
    using System;
    using System.Collections.Generic;
    using System.IO;

    /// <summary>
    /// The type WorkbookWorksheetAddRequestBuilder.
    /// </summary>
    public partial class WorkbookWorksheetAddRequestBuilder : BaseActionMethodRequestBuilder<IWorkbookWorksheetAddRequest>, IWorkbookWorksheetAddRequestBuilder
    {
        /// <summary>
        /// Constructs a new <see cref="WorkbookWorksheetAddRequestBuilder"/>.
        /// </summary>
        /// <param name="requestUrl">The URL for the request.</param>
        /// <param name="client">The <see cref="IBaseClient"/> for handling requests.</param>
        /// <param name="name">A name parameter for the OData method call.</param>
        public WorkbookWorksheetAddRequestBuilder(
            string requestUrl,
            IBaseClient client,
            string name)
            : base(requestUrl, client)
        {
            this.SetParameter("name", name, true);
        }

        /// <summary>
        /// A method used by the base class to construct a request class instance.
        /// </summary>
        /// <param name="functionUrl">The request URL to </param>
        /// <param name="options">The query and header options for the request.</param>
        /// <returns>An instance of a specific request class.</returns>
        protected override IWorkbookWorksheetAddRequest CreateRequest(string functionUrl, IEnumerable<Option> options)
        {
            var request = new WorkbookWorksheetAddRequest(functionUrl, this.Client, options);

            if (this.HasParameter("name"))
            {
                request.RequestBody.Name = this.GetParameter<string>("name");
            }

            return request;
        }
    }
}
