using System;
using System.Diagnostics.Tracing;

namespace Valg.EVA.Skanning.Diagnostics
{
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    [EventSource(Name = "Valgdirektoratet-EVASkanning", Guid = "D565CB9A-912F-4534-A87B-53E2793F9A24")]
    public sealed class EvaSkanningEventSource : EventSource
    {
        private static readonly int maxStackTraceLength = 1000;
        private static readonly Lazy<EvaSkanningEventSource> instance = new Lazy<EvaSkanningEventSource>(() => new EvaSkanningEventSource());

        public static EvaSkanningEventSource Log => instance.Value;

        private EvaSkanningEventSource()
            
        {
        }

        public class EvaSkanningTasks
        {
            public const EventTask ApplicationStartup = (EventTask)1;
        }



        [Event(1,
            Message = "Application startup for {0} initiated",
            Level = EventLevel.Informational,
            Opcode = EventOpcode.Start,
            Task = EvaSkanningTasks.ApplicationStartup,
            Channel = EventChannel.Debug)]
        public void StartupInitiated(string hostProcess)
        {
            if (IsEnabled())
            {
                WriteEvent(1, hostProcess.NotNull());
            }
        }


        [Event(2,
            Level = EventLevel.Informational,
            Opcode = EventOpcode.Stop,
            Message = "Application startup for {0} completed",
            Task = EvaSkanningTasks.ApplicationStartup,
            Channel = EventChannel.Debug)]
        public void StartupCompleted(string hostProcess)
        {
            if (IsEnabled())
            {
                WriteEvent(2, hostProcess.NotNull());
            }
        }

        [Event(3,
            Level = EventLevel.Informational,
            Channel = EventChannel.Operational,
            Message = "Logging sink of type {2} configured with destination {1} for {0}")]
        public void InProcessLoggingSinkConfigurationSuccess(string hostProcess, string destination, string sinkType)
        {
            if (IsEnabled())
            {
                WriteEvent(3, hostProcess.NotNull(), destination.NotNull(), sinkType.NotNull());
            }
        }

        [Event(4,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "Configuration of sink {3} with attempted destination {2} failed due to {1} for process {0}")]
        public void InProcessLoggingSinkConfigurationFailed(string hostProcess, string exceptionToString, string destinatonAttempted, string sinkType)
        {
            if (IsEnabled())
            {
                WriteEvent(4, hostProcess.NotNull(), exceptionToString.NotNull().Truncate(maxStackTraceLength), destinatonAttempted.NotNull(), sinkType.NotNull());
            }
        }

        [Event(5,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "An unhandled exception occured in {0}: {1}")]
        public void UnhandledException(string hostProcess, string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(5, hostProcess.NotNull(), exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }
        [Event(6,
            Level = EventLevel.Critical,
            Channel = EventChannel.Operational,
            Message = "Database connection test failed when trying to connect to {1} in process {0}. Please review the appropriate connection string, located in the application configuration file.")]
        public void DatabaseConnectionTestFailed(string hostProcess, string databaseServerName)
        {
            if (IsEnabled())
            {
                WriteEvent(6, hostProcess.NotNull(), databaseServerName.NotNull());
            }
        }

        [Event(7,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "An unhandled SqlException occured in {0}: {1}. Review connection strings and verify that database is operational.")]
        public void UnhandledSqlException(string hostProcess, string sqlExceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(7, hostProcess.NotNull(), sqlExceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(8,
            Level = EventLevel.Critical,
            Channel = EventChannel.Operational,
            Message = "The database at {2} with version {1} is not compatible with the expected version by the application {0}. Either upgrade the database or upgrade the client application.")]
        public void DatabaseCompatibilityTestFailed(string expectedDatabaseVersion, string actualDatabaseVersion, string databaseServerName)
        {
            if (IsEnabled())
            {
                WriteEvent(8, expectedDatabaseVersion.NotNull(), actualDatabaseVersion.NotNull(), databaseServerName.NotNull());
            }
        }

        [Event(9,
            Level = EventLevel.Critical,
            Channel = EventChannel.Operational,
            Message = "Application startup for {0} failed with the following exception: {1}")]
        public void ErrorInApplicationStartup(string hostProcess, string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(9, hostProcess.NotNull(), exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(10,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "An error occured while loading data in EVA Jobbstyring. Exception might be non-critical, provided that the error is transient (for instance the database was/is temporary unavailable). Consider taking action if this message appears repeatedly. The exception was: {0}")]
        public void ErrorWhileLoadingJobbstyringData(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(10, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(11,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "An error was reported from the ReadSoft framework. If there is a non-transient problem with the scanner, try to restart the computer. Details: {0}")]
        public void ErrorFromReadsoft(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(11, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(12,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "An error occured while attempting to download the help mapping uri's from {1}. As a result, the built-in redirect to help pages on Valgmedarbeiderportalen might be unavailable. " +
                      "Details: {0}")]
        public void ErrorWhileDownloadingHelpUriMapping(string exceptionToString, string urlAttempted)
        {
            if (IsEnabled())
            {
                WriteEvent(12, exceptionToString.NotNull().Truncate(maxStackTraceLength), urlAttempted.NotNull());
            }
        }

        [Event(13,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "An unexpected error occured while logging in into target EVA Admin environment {2}, process {0}. Details: {1}")]
        public void ErrorWhileLoggingIn(string hostProcess, string exceptionToString, string targetEvaAdminEnvironment)
        {
            if (IsEnabled())
            {
                WriteEvent(13, hostProcess.NotNull(), exceptionToString.NotNull().Truncate(maxStackTraceLength), targetEvaAdminEnvironment.NotNull());
            }
        }

        [Event(14,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "Error while checking for transfer status. The error might be transient. " +
                      "This message might appear repeatedly due to retry logic, but the status check will stop by itself after a given interval. " +
                      "Target EVA Admin environment: {2}, Transfer details: {0}, Exception details: {1}")]
        public void TransferStatusCheckFailed(string transferInfo, string exceptionToString, string targetEvaAdminEnvironment)
        {
            if (IsEnabled())
            {
                WriteEvent(14, transferInfo.NotNull(), exceptionToString.NotNull().Truncate(maxStackTraceLength), targetEvaAdminEnvironment.NotNull());
            }
        }

        [Event(15,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "An attempt to set the transfer with Id = {0} in failed state failed. " +
                      "This was attempted after the sendTimeout had expired and the transfer was still not confirmed as received by the EVA Admin system. " +
                      "This might not be a critical error, since the user can/will retransmit the file. Exception: {1}"
        )]
        public void ErrorWhileAttemptingToSetTransferInFailedState(int transferId, string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(15, transferId, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(16,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "An unhandled exception occured in background service {0}. Details: {1}.")]
        public void UnhandledExceptionInBackgroundService(string backgroundServiceName, string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(16, backgroundServiceName.NotNull(), exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(17,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "Signing data failed with the following exception: {0}")]
        public void SigningOfDataFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(17, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(20,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "Signature check failed using the production election event certificate bundled in the signature(pem). " +
                      "This can indicate the following: " +
                      "The election event certificate used is a test certificate (which might be OK if in a test environment), " +
                      "or the certificate thumbprint does not match corresponding app.config setting, " +
                      "or the certificate chain could not be validated. " +
                      "In case of a outdated Certificate Revocation List (CRL) or unavailable CRL server, " +
                      "please consider putting the computer in question online so that the CRL can updated." +
                      "The exception was: {0}")]
        public void SignatureCheckFailedUsingProductionCertificate(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(20, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(21,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "Signature check failed after trying the fallback for test certificates/test environments. " +
                      "This means it is not possible to verify the digital signatures, either for production or test. " +
                      "Please check that the system is set up correct and that the environments both for logon and election event data are consistent. " +
                      "The exception was: {0}")]
        public void SignatureCheckFailedUsingTestCertificate(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(21, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(22,
            Level = EventLevel.Warning,
            Channel = EventChannel.Debug,
            Message = "Calling checkStatus for transferId = {0} resulted in an unknown response status. " +
                      "The status code was {1}. " +
                      "Target EVA Admin environment: {2}")]
        public void UnknownResponseStatusFromTransferStatusCheck(int transferId, int responseStatusCode, string targetEvaAdminEnvironment)
        {
            if (IsEnabled())
            {
                WriteEvent(22, transferId, responseStatusCode, targetEvaAdminEnvironment.NotNull());
            }
        }

        [Event(23,
            Level = EventLevel.Informational,
            Channel = EventChannel.Debug,
            Message = "A concurrency exception occured in {0}. This is in most cases not an error, just an indication that a user had stale data when attempting to write to the database. "
                      +
                      "Exception details: {1}")]
        public void ConcurrencyError(string originatingTypeName, string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(23, originatingTypeName.NotNull(), exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(24,
            Level = EventLevel.Informational,
            Channel = EventChannel.Operational,
            Message = "Transfer of transferId = {0} succeeded. " +
                      "FileId: {1}." +
                      "EVA Admin target environment: {2}")]
        public void TransferOfCountingSucceeded(int transferId, long fileId, string evaAdminTargetEnvironment)
        {
            if (IsEnabled())
            {
                WriteEvent(24, transferId, fileId, evaAdminTargetEnvironment.NotNull());
            }
        }

        [Event(25,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "Transfer of counting with transferId = {0} failed. " +
                      "Details: " +
                      "Message = {1}, ErrorCode = {2}, ErrorString = {3}. " +
                      "The error might be caused be user-error, for instance attempting to transfer a counting when the EVA Admin system is not ready to accept for instance the counting type in question. " +
                      "Exception caught: {4}." +
                      "Target EVA Admin environment: {5}")]
        public void TransferOfCountingFailed(int transferId, string message, string errorCode, string errorString, string exceptionToString, string targetEvaAdminEnvironment)
        {
            if (IsEnabled())
            {
                WriteEvent(25, transferId, message.NotNull(), errorCode.NotNull(), errorString.NotNull(), exceptionToString.NotNull().Truncate(maxStackTraceLength), targetEvaAdminEnvironment.NotNull());
            }
        }


        [Event(26,
            Level = EventLevel.Error,
            Channel = EventChannel.Admin,
            Message = "Using batch in ReadSoft FORMS JOB file is not supported")]
        public void NotSupportedBatchSettingInReadsoftIsUsed()
        {
            if (IsEnabled())
            {
                WriteEvent(26);
            }
        }

        [Event(27,
            Level = EventLevel.Warning,
            Channel = EventChannel.Debug,
            Message = "An attempt was made to programmatically stop the job in ReadSoft, but it failed with return code {0}")]
        public void ReadsoftJobAttemptedStopWithFailure(int returnCodeFromStopAttempt)
        {
            if (IsEnabled())
            {
                WriteEvent(27, returnCodeFromStopAttempt);
            }
        }

        [Event(28,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "Resolution of duplicates failed. Exception details: {0}")]
        public void DuplicatesResolutionFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(28, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(29,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "Unlock of locked ballots failed. Exception details: {0}")]
        public void UnlockOfLockedBallotsFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(29, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(30,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "Saving a verified ballot failed. Exception details: {0}")]
        public void SaveBallotVerificationsFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(30, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(31,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "Saving a scanned ballot failed. Exception details: {0}")]
        public void SaveScannedBallotFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(31, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(32,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "Getting the next ballot to verify failed. Exception details: {0}")]
        public void GetNextBallotToVerifyFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(32, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(33,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "Activating emergency mode failed. This might be caused by incomplete election configuration. Exception details: {0}")]
        public void ActivatingEmergencyModeFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(33, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(34,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "Generating the counting result failed. Exception details: {0}")]
        public void GenerateCountingResultFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(34, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(35,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "Generating placeholder fields for write-in candidates failed. Exception details: {0}")]
        public void GeneratingWriteInPlaceholderFieldsFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(35, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(36,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "Interpretation of all scanned ballots in a box failed. Exception details: {0}")]
        public void BoxInterpretationStepFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(36, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(37,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "Duplicate check step failed. Exception details: {0}")]
        public void DuplicateCheckStepFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(37, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(38,
            Level = EventLevel.Warning,
            Channel = EventChannel.Operational,
            Message = "Getting locked ballots failed. Exception details: {0}")]
        public void GetLockedBallotsFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(38, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(39,
            Level = EventLevel.Error,
            Channel = EventChannel.Admin,
            Message = "Import of election config from path {1} failed. Messages from import process: {2}. Exception details: {0}")]
        public void ElectionConfigImportFailed(string exceptionToString, string path, string importMessages)
        {
            if (IsEnabled())
            {
                WriteEvent(39, exceptionToString.NotNull().Truncate(maxStackTraceLength), path.NotNull(), importMessages.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(40,
            Level = EventLevel.Informational,
            Channel = EventChannel.Admin,
            Message = "Import of election config from path {0} succeeded. Messages from import process: {1}")]
        public void ElectionConfigImportSucceeded(string path, string importMessages)
        {
            if (IsEnabled())
            {
                WriteEvent(40, path.NotNull(), importMessages.NotNull());
            }
        }

        [Event(41,
            Level = EventLevel.Informational,
            Channel = EventChannel.Admin,
            Message = "LocalDb-configuration was detected by EVA Oppsett. Will NOT recreate(delete) the database if it already exists.")]
        public void LocalDbConfigurationDetected()
        {
            if (IsEnabled())
            {
                WriteEvent(41);
            }
        }

        [Event(42,
            Level = EventLevel.Error,
            Channel = EventChannel.Admin,
            Message = "Upgrading the database on server {0} on database named {1} failed. Exception details: {2}")]
        public void UpgradingEvaSkanningDatabaseFailed(string databaseServer, string databaseName, string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(42, databaseServer.NotNull(), databaseName.NotNull(), exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(43,
            Level = EventLevel.Error,
            Channel = EventChannel.Admin,
            Message = "Dropping the database on server {0} on database named {1} failed. Exception details: {2}")]
        public void DroppingEvaSkanningDatabaseFailed(string databaseServer, string databaseName, string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(43, databaseServer.NotNull(), databaseName.NotNull(), exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(44,
            Level = EventLevel.Informational,
            Channel = EventChannel.Admin,
            Message = "Forcing delete of database files located at {0} when creating the localdb instance. Database files may remain from previous installations.")]
        public void ForcingDeleteOfDatabaseFilesOnLocalDbInit(string location)
        {
            if (IsEnabled())
            {
                WriteEvent(44, location.NotNull());
            }
        }

        [Event(45,
            Level = EventLevel.Error,
            Channel = EventChannel.Admin,
            Message = "The database installation was attempted started from the console, but failed due to the following exception: {0}")]
        public void LaunchingTheDatbaseInstallationProcessFromConsoleEnvironmentFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(45, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(46,
            Level = EventLevel.Error,
            Channel = EventChannel.Admin,
            Message = "Getting the folder structure for the Sql Server server instance failed. Exception details: {0}")]
        public void GetFolderStructureForSqlServerFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(46, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(47,
            Level = EventLevel.Error,
            Channel = EventChannel.Admin,
            Message = "Setting a file location failed. Exception details: {0}")]
        public void SettingSqlServerFileLocationFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(47, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(48,
            Level = EventLevel.Critical,
            Channel = EventChannel.Admin,
            Message = "The connection string configured for EVA Skanning Oppsett is not in the correct format. Review the configuration file. Exception details: {0}")]
        public void ConnectionStringIsNotValid(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(48, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(49,
            Level = EventLevel.Critical,
            Channel = EventChannel.Admin,
            Message = "There was an error when attempting to start the EVA Skanning Oppsett tool. Exception details: {0}")]
        public void StartupForEvaSkanningOppsettFailed(string exceptionDetails)
        {
            if (IsEnabled())
            {
                WriteEvent(49, exceptionDetails.NotNull().Truncate(maxStackTraceLength));
            }
        }


        [Event(50,
            Level = EventLevel.Informational,
            Channel = EventChannel.Admin,
            Message = "{0}")]
        public void DatabaseInstallationProgressUpdate(string message)
        {
            if (IsEnabled())
            {
                WriteEvent(50, message.NotNull().Truncate(maxStackTraceLength));
            }
        }

        [Event(51,
            Level = EventLevel.Informational,
            Channel = EventChannel.Analytic,
            Message = "A performance measurement event was recorded. EventId: {0}, event name: {1}, elapsed time: {2} ms. Full event details: {3}")]
        public void MeasurementRecorded(int eventId, string eventName, double elapsedTimeInMs, string fullEventDetail)
        {
            if (IsEnabled())
            {
                WriteEvent(51, eventId, eventName, elapsedTimeInMs, fullEventDetail.NotNull());
            }
        }

        [Event(52,
            Level = EventLevel.Informational,
            Channel = EventChannel.Operational,
            Message = "Logging sink of type {1} was not configured for {0} since it is not enabled in the configuration file.")]
        public void InProcessLoggingSinkConfigurationNotEnabled(string hostProcess, string sinkType)
        {
            if (IsEnabled())
            {
                WriteEvent(52, hostProcess.NotNull(), sinkType.NotNull());
            }
        }

        [Event(53,
            Level = EventLevel.Informational,
            Channel = EventChannel.Admin,
            Message = "Scanner Quality Check reported the following result: {0}")]
        public void ScannerQualityCheckCompleted(string result)
        {
            if (IsEnabled())
            {
                WriteEvent(53, result.NotNull());
            }
        }

        [Event(54,
            Level = EventLevel.Informational,
            Channel = EventChannel.Operational,
            Message = "No status information has been received from the EVA Admin system for the counting transfer with transferId = {0} inside the predefined timeout of {1} seconds. " +
                      "The system will attempt to put the transfer in a failed state." +
                      "Target EVA Admin environment: {2}")]
        public void TransferIsAbandonedAndEligibleForCleanup(int transferId, int timeout, string targetEvaAdminEnvironment)
        {
            if (IsEnabled())
            {
                WriteEvent(54, transferId, timeout, targetEvaAdminEnvironment.NotNull());
            }
        }

        [Event(55,
            Level = EventLevel.Informational,
            Channel = EventChannel.Admin,
            Message = "Scanned images from Scanner Quality Check was saved at the following locations: " +
                      "Front image was saved here: {0}," +
                      "Back image was saved here: {1}")]
        public void ScannerQualityCheckImagesSaved(string pathToFrontImage, string pathToBackImage)
        {
            if (IsEnabled())
            {
                WriteEvent(55, pathToFrontImage.NotNull(), pathToBackImage.NotNull());
            }
        }

        [Event(56,
            Level = EventLevel.Informational,
            Channel = EventChannel.Analytic,
            Message = "The following scanner model was selected in EVA Skann: {0}")]
        public void ScannerModelSelected(string scannerModel)
        {
            if (IsEnabled())
            {
                WriteEvent(56, scannerModel.NotNull());
            }
        }

        [Event(57,
            Level = EventLevel.Informational,
            Channel = EventChannel.Analytic,
            Message = "System information was collected: {0}")]
        public void SystemInformationCollected(string collectionReportAsJson)
        {
            if (IsEnabled())
            {
                WriteEvent(57, collectionReportAsJson.NotNull());
            }
        }

        [Event(58,
            Level = EventLevel.Warning,
            Channel = EventChannel.Analytic,
            Message = "System information collection failed with the following exception: {0}")]
        public void SystemInformationCollectionFailed(string exceptionToString)
        {
            if (IsEnabled())
            {
                WriteEvent(58, exceptionToString.NotNull().Truncate(maxStackTraceLength));
            }
        }


        [Event(59,
            Level = EventLevel.Error,
            Channel = EventChannel.Operational,
            Message = "Scanned images from Scanner Quality Check could not be saved at the following locations: " +
                      "Front: {0}," +
                      "Back: {1}" +
                      "The error message was: {2}")]
        public void ErrorSavingScannerQualityCheckImages(string pathToFrontImage, string pathToBackImage, string errorMessage)
        {
            if (IsEnabled())
            {
                WriteEvent(59, pathToFrontImage.NotNull(), pathToBackImage.NotNull(), errorMessage.NotNull().Truncate(maxStackTraceLength));
            }
        }

    }
}
