//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// DataHelpers.SQL satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using u = user_rtx;

namespace DataHelpers.SQL {

//**************************************************************************************************
[h_db_orm_type]
public class HSPCommandResultOutN<TOutData>: HSPCommandResult
where TOutData: class
{
// public SPResultStateForm StateForm;
// public bool IsAvailable;
// public bool Success;
// [u.opt_value] public Guid Status;
// public string? OutMessage;
// public string ErrorMessage;
// [u.strict_result] public string OutMessageNN;
// VerifyAvailable();

   public bool HasOutput => _output != null;
   /// <exception cref="InvalidOperationException" />
   public TOutData? Output {
      get {
         VerifyAvailable();
         return _output;
      }}

   /// <exception cref="InvalidOperationException" />
   [u.strict_result]
   public TOutData OutputNN =>
      Output ?? throw HSPResultError.OutputDataUnavailable;

   public HSPCommandResultOutN()
   {}
   public HSPCommandResultOutN( HSPResultParameters resultParams,
                                TOutData? output )
   : base( resultParams ) =>
      _output = output;
   public HSPCommandResultOutN( bool success, Guid status, string? outMessage,
                                TOutData? output )
   : base( success, status, outMessage ) =>
      _output = output;
   public HSPCommandResultOutN( HSPCommandResultOut<TOutData> result )
   : base( result.Success, result.Status, result.OutMessage ) =>
      _output = result.GetOutput();

   readonly TOutData? _output;

} // HSPCommandResultOutN<TOutData>
//**************************************************************************************************

//**************************************************************************************************
[h_db_orm_type]
public class HSPCommandResultOutRVN<TOutData>: HSPCommandResultRV
where TOutData: class
{
// public SPResultStateForm StateForm;
// public bool IsAvailable;
// public int RetValue;
// [u.opt_value] public Guid Status;
// public string? OutMessage;
// public string OutMessageAsError;
// [u.strict_result] public string OutMessageNN;
// VerifyAvailable();

   public bool HasOutput => _output != null;
   /// <exception cref="InvalidOperationException" />
   public TOutData? Output {
      get {
         VerifyAvailable();
         return _output;
      }}

   /// <exception cref="InvalidOperationException" />
   [u.strict_result]
   public TOutData OutputNN =>
      Output ?? throw HSPResultError.OutputDataUnavailable;

   public HSPCommandResultOutRVN()
   {}
   public HSPCommandResultOutRVN( HSPResultParameters resultParams,
                                  TOutData? output )
   : base( resultParams ) =>
      _output = output;
   public HSPCommandResultOutRVN( int retValue, Guid status, string? outMessage,
                                  TOutData? output )
   : base( retValue, status, outMessage ) =>
      _output = output;
   public HSPCommandResultOutRVN( HSPCommandResultOutRV<TOutData> result )
   : base( result.RetValue, result.Status, result.OutMessage ) =>
      _output = result.GetOutput();

   readonly TOutData? _output;

} // HSPCommandResultOutRVN<TOutData>
//**************************************************************************************************

} // DataHelpers.SQL
