using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;

using CommonHelpers;

namespace BookRegistry.Server {

//**************************************************************************************************
partial class GeneralApiResponse<TItem> {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse(HSPCommandResult spResult)
: base( spResult ) => CheckItems_Arguments();
/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse(HSPCommandResultRV spResult)
: base( spResult ) => CheckItems_Arguments();

//--------------------------------------------------------------------------------------------------

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse(HSPResult<TItem> spResult)
: this( spResult, spResult.GetList() ) => CheckItems_Arguments();
/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse(HSPResultRV<TItem> spResult)
: this( spResult, spResult.GetList() ) => CheckItems_Arguments();

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse(HSPResultN<TItem> spResult)
: this( spResult, spResult.List ) => CheckItems_Arguments();
/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse(HSPResultRVN<TItem> spResult)
: this( spResult, spResult.List ) => CheckItems_Arguments();

//==================================================================================================

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse(HSPCommandResult spResult,List<TItem>? list)
: base( spResult ) { _Items_ = list; CheckItems_Arguments(); }

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse(HSPCommandResultRV spResult,List<TItem>? list)
: base( spResult ) { _Items_ = list; CheckItems_Arguments(); }

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse(bool success,HSPCommandResultRV spResult,List<TItem>? list)
: base( success, spResult ) { _Items_ = list; CheckItems_Arguments(); }

//--------------------------------------------------------------------------------------------------

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse( HSPCommandResult spResult, List<TItem>? list, string? message )
: base( spResult, message ) { _Items_ = list; CheckItems_Arguments(); }

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse( HSPCommandResultRV spResult,
                             List<TItem>? list,
                             string? message )
: base( spResult, message ) { _Items_ = list; CheckItems_Arguments(); }

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse( bool success, HSPCommandResultRV spResult,
                             List<TItem>? list, string? message )
: base( success, spResult, message ) { _Items_ = list; CheckItems_Arguments(); }

//==================================================================================================

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse( HSPCommandResult spResult, IEnumerable<TItem>? items )
: base( spResult )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
    CheckItems_Arguments();
}

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse( HSPCommandResultRV spResult, IEnumerable<TItem>? items )
: base( spResult )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
    CheckItems_Arguments();
}
/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse( bool success, HSPCommandResultRV spResult, IEnumerable<TItem>? items )
: base( success, spResult )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
    CheckItems_Arguments();
}

//--------------------------------------------------------------------------------------------------

/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse( HSPCommandResult spResult,
                             IEnumerable<TItem>? items,
                             string? message )
: base( spResult, message )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
    CheckItems_Arguments();
}
/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse( HSPCommandResultRV spResult,
                             IEnumerable<TItem>? items,
                             string? message )
: base( spResult, message )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
    CheckItems_Arguments();
}
/// <exception cref="ArgumentException" />
/// <exception cref="InvalidOperationException" />
internal GeneralApiResponse( bool success, HSPCommandResultRV spResult,
                             IEnumerable<TItem>? items, string? message )
: base( success, spResult, message )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
    CheckItems_Arguments();
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // GeneralApiResponse<TItem>
//**************************************************************************************************

} // BookRegistry.Client/Server
