using System;

namespace Valg.EVA.Skanning.ServicesModel.ServiceContracts.TransferCounting.Write
{
    public class TransferCountingFailureDetails
    {
        public static readonly string generalError = "General";
        public static readonly string timeoutError = "TimeoutOnTransfer";

        public string Message { get; }
        public int TransferId { get; }
        public string ErrorCode { get; }
        public string ErrorString { get; }
        public Exception Exception { get; }

        public TransferCountingFailureDetails(int transferId, string errorCode, string errorString)
        {
            TransferId = transferId;
            ErrorCode = errorCode;
            ErrorString = errorString;

            Message = $"EVA Admin transfer error {errorCode}: {errorString}. Local transferId = {transferId}";
        }

        public TransferCountingFailureDetails(int transferId, Exception exception, string errorCode)
        {
            TransferId = transferId;
            ErrorCode = errorCode;
            ErrorString = exception.Message;
            Exception = exception;

            Message = string.Empty;
        }
    }
}
