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

using CommonHelpers;

namespace MyFlat {

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

internal GeneralApiResponse(HSPCommandResult spResult)
: base( spResult )
{}
internal GeneralApiResponse(HSPCommandResultRV spResult)
: base( spResult )
{}

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

internal GeneralApiResponse(HSPResult<TItem> spResult)
: this( spResult, spResult.GetList() )
{}
internal GeneralApiResponse(HSPResultRV<TItem> spResult)
: this( spResult, spResult.GetList() )
{}

internal GeneralApiResponse(HSPResultN<TItem> spResult)
: this( spResult, spResult.List )
{}
internal GeneralApiResponse(HSPResultRVN<TItem> spResult)
: this( spResult, spResult.List )
{}

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

internal GeneralApiResponse(HSPCommandResult spResult,List<TItem>? list)
: base( spResult ) => _Items_ = list;

internal GeneralApiResponse(HSPCommandResultRV spResult,List<TItem>? list)
: base( spResult ) => _Items_ = list;

internal GeneralApiResponse(bool success,HSPCommandResultRV spResult,List<TItem>? list)
: base( success, spResult ) => _Items_ = list;

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

internal GeneralApiResponse( HSPCommandResult spResult, List<TItem>? list, string? message )
: base( spResult, message ) => _Items_ = list;

internal GeneralApiResponse( HSPCommandResultRV spResult,
                             List<TItem>? list,
                             string? message )
: base( spResult, message ) => _Items_ = list;

internal GeneralApiResponse( bool success, HSPCommandResultRV spResult,
                             List<TItem>? list, string? message )
: base( success, spResult, message ) => _Items_ = list;

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

internal GeneralApiResponse(HSPCommandResult spResult,IEnumerable<TItem>? items)
: base( spResult )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
}

internal GeneralApiResponse(HSPCommandResultRV spResult,IEnumerable<TItem>? items)
: base( spResult )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
}
internal GeneralApiResponse(bool success,HSPCommandResultRV spResult,IEnumerable<TItem>? items)
: base( success, spResult )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
}

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

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

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

} // MyFlat
