// <auto-generated>
// DO NOT EDIT: generated by fsdgencsharp
// </auto-generated>
using System;
using System.Threading;
using System.Threading.Tasks;
using Facility.Core;

namespace OapApi.v1.Client
{
	/// <summary>
	/// A delegating implementation of OapApiV1.
	/// </summary>
	[System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")]
	public partial class DelegatingOapApiV1 : IOapApiV1
	{
		/// <summary>
		/// Creates an instance with the specified delegator.
		/// </summary>
		public DelegatingOapApiV1(ServiceDelegator delegator) =>
			m_delegator = delegator ?? throw new ArgumentNullException(nameof(delegator));

		/// <summary>
		/// Gets applications for the current user.
		/// </summary>
		public virtual async Task<ServiceResult<GetApplicationsResponseDto>> GetApplicationsAsync(GetApplicationsRequestDto request, CancellationToken cancellationToken = default) =>
			(await m_delegator(OapApiV1Methods.GetApplications, request, cancellationToken).ConfigureAwait(false)).Cast<GetApplicationsResponseDto>();

		/// <summary>
		/// Creates a new application for the current user.
		/// </summary>
		public virtual async Task<ServiceResult<CreateApplicationResponseDto>> CreateApplicationAsync(CreateApplicationRequestDto request, CancellationToken cancellationToken = default) =>
			(await m_delegator(OapApiV1Methods.CreateApplication, request, cancellationToken).ConfigureAwait(false)).Cast<CreateApplicationResponseDto>();

		/// <summary>
		/// Gets the specified application for the current user.
		/// </summary>
		public virtual async Task<ServiceResult<GetApplicationResponseDto>> GetApplicationAsync(GetApplicationRequestDto request, CancellationToken cancellationToken = default) =>
			(await m_delegator(OapApiV1Methods.GetApplication, request, cancellationToken).ConfigureAwait(false)).Cast<GetApplicationResponseDto>();

		/// <summary>
		/// Updates the application.
		/// </summary>
		public virtual async Task<ServiceResult<UpdateApplicationResponseDto>> UpdateApplicationAsync(UpdateApplicationRequestDto request, CancellationToken cancellationToken = default) =>
			(await m_delegator(OapApiV1Methods.UpdateApplication, request, cancellationToken).ConfigureAwait(false)).Cast<UpdateApplicationResponseDto>();

		private readonly ServiceDelegator m_delegator;
	}
}
