//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// UserRTX.NET satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;

#if !WASM
namespace user_rtx { using u = user_rtx;
#else
namespace user_rtx.wasm { using u = user_rtx.wasm;
#endif

/// <summary>
/// String argument checking
/// </summary>
public static class str_argcheck {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="ArgumentException" />
[u.returns_source]
public static string NE( string value, string paramName ) =>
   u.arg_check.NN( value, nameof(value) ) != "" ? value :
      throw u.str_argcheck_errors.NONEMPTY_STRING_WAS_EXPECTED( paramName );

/// <exception cref="ArgumentException" />
[u.returns_source]
public static string NWS( string value, string paramName ) =>
   u.arg_check.NN( value, nameof(value) ) != "" ? value :
      throw u.str_argcheck_errors.NONWS_STRING_WAS_EXPECTED( paramName );

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

/// <exception cref="ArgumentException" />
[u.returns_source]
public static string[] NE_Array( string paramName, params string[] values )
{
   foreach ( var value in u.arg_check.NN(values,nameof(values)) )
      if ( u.arg_check.NN( value, "values[]" ) == "" )
         throw u.str_argcheck_errors.LIST_OF_NONEMPTY_STRINGS_WAS_EXPECTED( paramName );
   return values;
}

/// <exception cref="ArgumentException" />
[u.returns_source]
public static string[] NWS_Array( string paramName, params string[] values )
{
   foreach ( var value in u.arg_check.NN(values,nameof(values)) )
      if ( u.str.IsWS( u.arg_check.NN( value, "values[]" )))
         throw u.str_argcheck_errors.LIST_OF_NONWS_STRINGS_WAS_EXPECTED( paramName );
   return values;
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // str_argcheck

} // user_rtx (.wasm)
