//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// CommonHelpers satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Collections.Generic;
using System.Data.SqlClient;

namespace CommonHelpers {

//**************************************************************************************************
[HDbOrmType]
public class HSPResultOutN<TOutData,TListItem>: HSPCommandResultOutN<TOutData>
where TOutData: class
{
// public SPResultStateForm StateForm;
// public bool IsAvailable;
// public bool Success;
// [HOptionalValue] public Guid Status;
// [HOptionalValue] public string? OutMessage;
// [HNotNull] public string ErrorMessage;
// [HOptionalValue] public readonly TOutData? Output;
// [HStrictResult] public string OutMessageNN;
// [HStrictResult] public TOutData OutputNN;
// VerifyAvailable();

   public bool HasList => _List_ != null;
   /// <exception cref="InvalidOperationException" />
   [HOptionalValue]
   public List<TListItem>? List
   {
      get {
         VerifyAvailable();
         return _List_;
      }
   }
   /// <exception cref="InvalidOperationException" />
   [HStrictResult] public List<TListItem> ListNN =>
      List ?? throw HSPResultError.OutputListUnavailable;

   public HSPResultOutN()
   {}
   public HSPResultOutN( HSPResultParameters resultParams,
                         [HOptional] TOutData? output,
                         [HOptional] List<TListItem>? list )
   : base( resultParams, output ) =>
      _List_ = list;
   public HSPResultOutN( HSPResultOut<TOutData,TListItem> result )
   : base( result ) =>
      _List_ = result.GetList();

   [HOptionalValue] List<TListItem>? _List_;

} // HSPResultOutN<TOutData,TListItem>
//**************************************************************************************************

//**************************************************************************************************
[HDbOrmType]
public class HSPResultOutRVN<TOutData,TListItem>: HSPCommandResultOutRVN<TOutData>
where TOutData: class
{
// public SPResultStateForm StateForm;
// public bool IsAvailable;
// public int RetValue;
// [HOptionalValue] public Guid Status;
// [HOptionalValue] public string? OutMessage;
// [HNotNull] public string OutMessageAsError;
// [HOptionalValue] public readonly TOutData? Output;
// [HStrictResult] public string OutMessageNN;
// [HStrictResult] public TOutData OutputNN;
// VerifyAvailable();

   public bool HasList => _List_ != null;
   /// <exception cref="InvalidOperationException" />
   [HOptionalValue]
   public List<TListItem>? List
   {
      get {
         VerifyAvailable();
         return _List_;
      }
   }
   /// <exception cref="InvalidOperationException" />
   [HStrictResult] public List<TListItem> ListNN =>
      List ?? throw HSPResultError.OutputListUnavailable;

   public HSPResultOutRVN()
   {}
   public HSPResultOutRVN( HSPResultParameters resultParams,
                           [HOptional] TOutData? output,
                           [HOptional] List<TListItem>? list )
   : base( resultParams, output ) =>
      _List_ = list;
   public HSPResultOutRVN( HSPResultOutRV<TOutData,TListItem> result )
   : base( result ) =>
      _List_ = result.GetList();

   [HOptionalValue] List<TListItem>? _List_;

} // HSPResultOutRVN<TOutData,TListItem>
//**************************************************************************************************

} // CommonHelpers
