using System;

using CommonHelpers;

namespace BookRegistry.Server {

//**************************************************************************************************
partial class GeneralApiResponse {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

internal GeneralApiResponse(HSPCommandResult spResult)
: this( spResult.Success )
{
   Status = spResult.Status;
   if ( spResult.OutMessage != null )
      Message = spResult.OutMessage;
}
internal GeneralApiResponse(HSPCommandResultRV spResult)
: this( spResult.RetValue==0 )
{
   Status = spResult.Status;
   if ( spResult.OutMessage != null )
      Message = spResult.OutMessage;
}
internal GeneralApiResponse(bool success,HSPCommandResultRV spResult)
: this( success )
{
   Status = spResult.Status;
   if ( spResult.OutMessage != null )
      Message = spResult.OutMessage;
}

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

internal GeneralApiResponse(HSPCommandResult spResult,string? message)
: this( spResult.Success )
{
   Status = spResult.Status;
   message ??= spResult.OutMessage;
   if ( message != null )
      Message = message;
}
internal GeneralApiResponse(HSPCommandResultRV spResult,string? message)
: this( spResult.RetValue==0 )
{
   Status = spResult.Status;
   message ??= spResult.OutMessage;
   if ( message != null )
      Message = message;
}
internal GeneralApiResponse(bool success,HSPCommandResultRV spResult,string? message)
: this( success )
{
   Status = spResult.Status;
   message ??= spResult.OutMessage;
   if ( message != null )
      Message = message;
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // GeneralApiResponse
//**************************************************************************************************

} // BookRegistry.Client/Server
