using System.Collections.Generic;

namespace NodePipeline.Constants.ValidationResults;

public static class ErrorMessages
{
    public const string RequiredInputPortHasNoConnectionError =
        "NodePipeline.Constants.ErrorMessages." + nameof(RequiredInputPortHasNoConnectionError);

    public const string OutputPortNotFoundError =
        "NodePipeline.Constants.ErrorMessages." + nameof(OutputPortNotFoundError);

    public const string PortsTypeMismatchError =
        "NodePipeline.Constants.ErrorMessages." + nameof(PortsTypeMismatchError);

    public const string RequiredNodeParameterValidationError =
        "NodePipeline.Constants.ErrorMessages." + nameof(RequiredNodeParameterValidationError);

    public const string NodeValidationError = "NodePipeline.Constants.ErrorMessages." + nameof(NodeValidationError);

    public const string NullableAndNonNullablePortsConnectionWarning = "NodePipeline.Constants.ErrorMessages." +
                                                                       nameof(
                                                                           NullableAndNonNullablePortsConnectionWarning);

    public static readonly Dictionary<string, string> MessagesEn = new()
    {
        { RequiredInputPortHasNoConnectionError, "Required input port [{0}] of node [{1}] has no connection." },
        {
            OutputPortNotFoundError,
            "Output port [{0}] of [{1}] node was not found. Check [{2}] input port connection of node [{3}]."
        },
        {
            PortsTypeMismatchError,
            "Input port [{0}] of [{1}] node with type [{2}] is connected to [{3}] output port of node [{4}] with incompatible type [{5}]. Check node [{1}] connection."
        },
        { RequiredNodeParameterValidationError, "Parameter [{0}] of node [{1}] is required nut was not set." },
        { NodeValidationError, "Node [{0}] is not valid." },
        {
            NullableAndNonNullablePortsConnectionWarning,
            "Input port [{0}] of [{1}] node with non-nullable type [{2}] is connected to [{3}] output port of node [{4}] with nullable type [{5}]. It can can provoke a runtime error if output is null."
        }
    };

    public static readonly Dictionary<string, string> MessagesRu = new()
    {
        {
            RequiredInputPortHasNoConnectionError,
            "Входной порт [{0}] ноды [{1}] не имеет обязательного соединения."
        },
        {
            OutputPortNotFoundError,
            "Выходной порт [{0}] ноды [{1}] не найден. Проверьте связь входного параметра [{2}] ноды [{3}]."
        },
        {
            PortsTypeMismatchError,
            "Входной порт [{0}] ноды [{1}] с типом [{2}] соединён с выходным портом [{3}] ноды [{4}] с несовместимым типом [{5}]. Проверьте связи [{1}] ноды."
        },
        { RequiredNodeParameterValidationError, "Обязательный параметр [{0}] ноды [{1}] не установлен." },
        { NodeValidationError, "Нода [{0}] не прошла валидацию." },
        {
            NullableAndNonNullablePortsConnectionWarning,
            "Входной порт [{0}], не допускающий null, ноды [{1}] с типом [{2}] соединён с выходным портом [{3}] ноды [{4}] с типом [{5}], допускающим null. Это может привести к ошибке во время выполнения."
        }
    };
}