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

#if !WASM
namespace CommonHelpers {
#else
namespace CommonHelpers.WASM {
#endif

//**************************************************************************************************
/// <summary>
/// </summary>
[Serializable]
public partial class HArgumentTypeException: HException {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public string ParamName { get; }

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

public HArgumentTypeException()
   :base ( "Incorrect argument type." ) {}
public HArgumentTypeException(string message)
   :base ( message ) {}
public HArgumentTypeException(string message,Exception innerException)
   :base ( message, innerException ) {}

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

public HArgumentTypeException(Type type)
   :base ( PrepareMessageFor( type ) ) {}
public HArgumentTypeException(Type type,Exception innerException)
   :base ( PrepareMessageFor( type ), innerException ) {}

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

/// <exception cref="ArgumentNullException" />
public HArgumentTypeException(string message,string paramName)
   :base ( message )
   { ParamName = HArgChecking.VerifyNotNull( paramName ); }
/// <exception cref="ArgumentNullException" />
public HArgumentTypeException(string message,string paramName,Exception innerException)
   :base ( message, innerException )
   { ParamName = HArgChecking.VerifyNotNull( paramName ); }

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

/// <exception cref="ArgumentNullException" />
public HArgumentTypeException(Type type,string paramName)
   :base ( PrepareMessageFor( type ) )
   { ParamName = HArgChecking.VerifyNotNull( paramName ); }
/// <exception cref="ArgumentNullException" />
public HArgumentTypeException(Type type,string paramName,Exception innerException)
   :base ( PrepareMessageFor( type ), innerException )
   { ParamName = HArgChecking.VerifyNotNull( paramName ); }

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

public static string PrepareMessageFor(Type type)
{
   HArgChecking.VerifyNotNull( type );
   return string.Format( "Incorrect argument type: \"{0}\".", type );
}

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

protected HArgumentTypeException(SerializationInfo info,StreamingContext context)
   :base ( info, context ) {}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HArgumentTypeException
//**************************************************************************************************

} // CommonHelpers (.WASM)
