//---------------------------------------------------------------------------------------------
// This file was AUTO-GENERATED by "REST Service Clients" Xomega.Net generator.
//
// Manual CHANGES to this file WILL BE LOST when the code is regenerated.
//---------------------------------------------------------------------------------------------

using Microsoft.Extensions.Options;
using System.Collections.Generic;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using Xomega.Framework.Services;

namespace AdventureWorks.Services
{
    ///<summary>
    /// Cross-reference table mapping people to their credit card information in the CreditCard table. 
    ///</summary>
    public class PersonCreditCardServiceClient : HttpServiceClient, IPersonCreditCardService
    {
        protected readonly JsonSerializerOptions SerializerOptions;

        public PersonCreditCardServiceClient(HttpClient httpClient, IOptionsMonitor<JsonSerializerOptions> options)
            : base(httpClient)
        {
            SerializerOptions = options.CurrentValue;
        }

        /// <inheritdoc/>
        public virtual async Task<Output<ICollection<PersonCreditCard_ReadListOutput>>> ReadListAsync(int _businessEntityId)
        {
            HttpRequestMessage msg = new HttpRequestMessage(HttpMethod.Get, $"person/{ _businessEntityId }/credit-card");
            using (var resp = await Http.SendAsync(msg, HttpCompletionOption.ResponseHeadersRead))
            {
                var content = await resp.Content.ReadAsStreamAsync();
                return await JsonSerializer.DeserializeAsync<Output<ICollection<PersonCreditCard_ReadListOutput>>>(content, SerializerOptions);
            }
        }
    }
}