//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// CommonHelpers satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Runtime.CompilerServices;

namespace CommonHelpers {

//**************************************************************************************************
[HDbOrmType]
public abstract partial class HResultSetItemBase: HPropertyNNBase {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static string PropertyName( string? propertyName ) => HPropertyNN.NameAuto( propertyName );
static string PropertyNameN( string? propertyNameN ) => HPropertyNN.NameAutoN( propertyNameN );
//==================================================================================================
[HAsyncStatic] protected static bool has_data => HDbQuery.HasData;
[HAsyncStatic] protected static bool no_data => HDbQuery.NoData;
//==================================================================================================

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult][HOptionalResult]
protected static T GET<T>( string columnName, bool treatNullAsDefaultValue=false ) =>
   HResultSetReader.GET<T>( columnName, treatNullAsDefaultValue );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static T GET<T>( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.GET<T>( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult][HOptionalResult]
protected static T GET<T>( bool treatNullAsDefaultValue,
                           [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.GET<T>( PropertyName( propertyName ), treatNullAsDefaultValue );

/// <exception cref="HArgumentTypeException" />
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult][HOptionalResult]
protected static T VAL<T>( string columnName, bool treatNullAsDefaultValue=false )
where T: struct =>
   HResultSetReader.VAL<T>( columnName, treatNullAsDefaultValue );
/// <exception cref="HArgumentTypeException" />
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static T VAL<T>( [CallerMemberName] string? propertyName=null )
where T: struct =>
   HResultSetReader.VAL<T>( PropertyName( propertyName ) );
/// <exception cref="HArgumentTypeException" />
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult][HOptionalResult]
protected static T VAL<T>( bool treatNullAsDefaultValue,
                           [CallerMemberName] string? propertyName=null )
where T: struct =>
   HResultSetReader.VAL<T>( PropertyName( propertyName ), treatNullAsDefaultValue );

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

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic]
protected static bool EXISTS( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.EXISTS( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static int IDX( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.IDX( PropertyName( propertyName ) );

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

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static string STR( string columnName, bool treatNullAsEmpty=false ) =>
   HResultSetReader.STR( columnName, treatNullAsEmpty );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static string STR( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.STR( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static string STR( bool treatNullAsEmpty,
                             [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.STR( PropertyName( propertyName ), treatNullAsEmpty );

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static string NS( string columnName, bool treatNullAsEmpty=false ) =>
   HResultSetReader.NS( columnName, treatNullAsEmpty );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static string NS( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.NS( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static string NS( bool treatNullAsEmpty,
                            [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.NS( PropertyName( propertyName ), treatNullAsEmpty );

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

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static int INT( string columnName, bool treatNullAsZero=false ) =>
   HResultSetReader.INT( columnName, treatNullAsZero );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static int INT( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.INT( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static int INT( bool treatNullAsZero,
                          [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.INT( PropertyName( propertyName ), treatNullAsZero );

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static long BIGINT( string columnName, bool treatNullAsZero=false ) =>
   HResultSetReader.BIGINT( columnName, treatNullAsZero );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static long BIGINT( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.BIGINT( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static long BIGINT( bool treatNullAsZero,
                              [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.BIGINT( PropertyName( propertyName ), treatNullAsZero );

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static double FP( string columnName, bool treatNullAsZero=false ) =>
   HResultSetReader.FP( columnName, treatNullAsZero );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static double FP( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.FP( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static double FP( bool treatNullAsZero,
                            [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.FP( PropertyName( propertyName ), treatNullAsZero );

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static decimal DEC( string columnName, bool treatNullAsZero=false ) =>
   HResultSetReader.DEC( columnName, treatNullAsZero );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static decimal DEC( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.DEC( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static decimal DEC( bool treatNullAsZero,
                              [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.DEC( PropertyName( propertyName ), treatNullAsZero );

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

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static bool BOOL( string columnName, bool treatNullAsFalse=false ) =>
   HResultSetReader.BOOL( columnName, treatNullAsFalse );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static bool BOOL( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.BOOL( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static bool BOOL( bool treatNullAsFalse,
                            [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.BOOL( PropertyName( propertyName ), treatNullAsFalse );

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static DateTime DT( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.DT( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static DateTime UTC( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.UTC( PropertyName( propertyName ) );

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static Guid GUID( string columnName, bool treatNullAsEmpty=false ) =>
   HResultSetReader.GUID( columnName, treatNullAsEmpty );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static Guid GUID( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.GUID( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static Guid GUID( bool treatNullAsEmpty,
                            [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.GUID( PropertyName( propertyName ), treatNullAsEmpty );

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

/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static byte[] BINARY( string columnName, bool treatNullAsEmpty=false ) =>
   HResultSetReader.BINARY( columnName, treatNullAsEmpty );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static byte[] BINARY( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.BINARY( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static byte[] BINARY( bool treatNullAsEmpty,
                                [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader.BINARY( PropertyName( propertyName ), treatNullAsEmpty );

//--------------------------------------------------------------------------------------------------
/*
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static ... ...(string columnName,bool treatNullAs...=false) =>
   HResultSetReader....( columnName, treatNullAs... );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static ... ...( [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader....( PropertyName( propertyName ) );
/// <exception cref="ArgumentNullException" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[HAsyncStatic][HStrictResult]
protected static ... ...( bool treatNullAs...,
                          [CallerMemberName] string? propertyName=null ) =>
   HResultSetReader....( PropertyName( propertyName ), treatNullAs... );
*/
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HResultSetItemBase
//**************************************************************************************************

} // CommonHelpers
