using System;
using System.Data.Common;

namespace EasyDev.Database
{
    /// <summary>
    /// 
    /// </summary>
    public static class ExceptionBuilder
    {
        /// <summary>
        /// Transactions the error.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        public static Exception TransactionError(string message)
        {
            return new Exception(message);
        }

        /// <summary>
        /// Nots the supported exception.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        public static Exception NotSupportedException(string message = null)
        {
            return new NotSupportedException(message);
        }

        /// <summary>
        /// Arguments the null.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        public static Exception ArgumentNull(string message = null)
        {
            return new ArgumentNullException(message);
        }
        /// <summary>
        /// Arguments the out of range.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        public static Exception ArgumentOutOfRange(string message = null)
        {
            return new ArgumentOutOfRangeException(message);
        }
        /// <summary>
        /// Invalids the length of the offset.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        public static Exception InvalidOffsetLength(string message = null)
        {
            return new ArgumentException(message);
        }

        /// <summary>
        /// Columns the out of range.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <returns></returns>
        public static Exception ColumnOutOfRange(int index)
        {
            return new IndexOutOfRangeException();
        }
        /// <summary>
        /// Columns the not in entity.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="entityName">Name of the entity.</param>
        /// <returns></returns>
        public static Exception ColumnNotInEntity(string columnName, string entityName)
        {
            return new ArgumentException();
        }
        /// <summary>
        /// Columns the out of range.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="entityName">Name of the entity.</param>
        /// <returns></returns>
        public static Exception ColumnOutOfRange(int index, string entityName)
        {
            return new ArgumentException();
        }

        /// <summary>
        /// Arguments the type not support.
        /// </summary>
        /// <param name="typeName">Name of the type.</param>
        /// <returns></returns>
        public static Exception ArgumentTypeNotSupport(string typeName)
        {
            return new ArgumentException(typeName);
        }

        /// <summary>
        /// Nots the implemented exception.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        public static Exception NotImplementedException(string message = null)
        {
            return new NotImplementedException(message);
        }

        /// <summary>
        /// Invalids the cast exception.
        /// </summary>
        /// <param name="fromType">From type.</param>
        /// <param name="toType">To type.</param>
        /// <returns></returns>
        public static Exception InvalidCastException(Type fromType, Type toType)
        {
            return new InvalidCastException($"Type: {fromType.Name} not cast to {toType.Name}");
        }

        /// <summary>
        /// Concurrencies the exception.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        public static Exception ConcurrencyException(string message)
        {
            return new ConcurrencyException(message);
        }


    }
}
