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

using CommonHelpers;

namespace BookRegistry.Server {

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

internal GeneralApiResponseNI(Exception e)
: base( e )
{}

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

internal GeneralApiResponseNI(List<TItem>? list)
: this( list!=null, list )
{}
internal GeneralApiResponseNI(List<TItem>? list,string? message)
: this( list!=null, list, message )
{}
internal GeneralApiResponseNI(List<TItem>? list,[HOptional] Guid status)
: this( list!=null, list, status )
{}
internal GeneralApiResponseNI(List<TItem>? list,string? message,[HOptional] Guid status)
: this( list!=null, list, message, status )
{}

internal GeneralApiResponseNI(IEnumerable<TItem>? items)
: this( items!=null, items )
{}
internal GeneralApiResponseNI(IEnumerable<TItem>? items,string? message)
: this( items!=null, items, message )
{}
internal GeneralApiResponseNI(IEnumerable<TItem>? items,[HOptional] Guid status)
: this( items!=null, items, status )
{}
internal GeneralApiResponseNI(IEnumerable<TItem>? items,string? message,[HOptional] Guid status)
: this( items!=null, items, message, status )
{}

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

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

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

internal GeneralApiResponseNI( bool success, List<TItem>? list, [HOptional] Guid status )
: base( success, status ) => _Items_ = list;

internal GeneralApiResponseNI( bool success, List<TItem>? list,
                               string? message, [HOptional] Guid status )
: base( success, message, status ) => _Items_ = list;

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

internal GeneralApiResponseNI( bool success, IEnumerable<TItem>? items )
: base( success )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
}
internal GeneralApiResponseNI( bool success, IEnumerable<TItem>? items, string? message )
: base( success, message )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
}
internal GeneralApiResponseNI( bool success, IEnumerable<TItem>? items, [HOptional] Guid status )
: base( success, status )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
}
internal GeneralApiResponseNI( bool success, IEnumerable<TItem>? items,
                               string? message, [HOptional] Guid status )
: base( success, message, status )
{
   if ( items != null )
      _Items_ = new List<TItem>( items );
}

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

/// <exception cref="InvalidOperationException" />
public static new GeneralApiResponseNI<TItem> CreateServerError(string errorMessage) =>
   new GeneralApiResponseNI<TItem>( errorMessage ){
      SpecialCategory = SpecialCategory_ServerError };

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // GeneralApiResponseNI<TItem>
//**************************************************************************************************

} // BookRegistry.Client/Server
