//----------------------------------------------------------------------------------------------------------------------
/// \file
/// <summary>Class used for opening/closing log contexts.</summary>
// Copyright (c) Microsoft Corporation.  All Rights Reserved.
//----------------------------------------------------------------------------------------------------------------------
#pragma once
#if defined(_WIN32)
#include "Wex.Logger.h"

#include "Log.h"

namespace WEX { namespace Logging
{
    /// <summary>
    ///
    /// </summary>
    class WEXLOGGER_API LogContext final
    {
    public:
        /// <summary>
        /// Create a new context
        /// </summary>
        /// <param name="pszParentContext"> </param>
        /// <param name="pszChildContext"> </param>
        /// <param name="pszChildData"> </param>
        static void __stdcall CreateContext(const wchar_t* pszParentContext, const wchar_t* pszChildContext, const wchar_t* pszChildData);
        
        /// <summary>
        /// Close the specified context, and assign it the specified test result
        /// </summary>
        /// <param name="pszContext"> </param>
        /// <param name="testResult"> </param>
        static void __stdcall CloseContext(const wchar_t* pszContext, TestResults::Result testResult);

        /// <summary>
        /// Log a comment in plain text for the specified context
        /// </summary>
        /// <param name="pszContext"> </param>
        /// <param name="pszComment"> </param>
        static void __stdcall LogComment(const wchar_t* pszContext, const wchar_t* pszComment);

        /// <summary>
        /// Log a test file to be saved for the specified context
        /// </summary>
        /// <param name="pszContext"> </param>
        /// <param name="pszFileName"> </param>
        static void __stdcall LogFile(const wchar_t* pszContext, const wchar_t* pszFileName);

        /// <summary>
        /// Log xml data for the specified context; no check is made to verify that it is well-formed
        /// </summary>
        /// <param name="pszContext"> </param>
        /// <param name="pszXml"> </param>
        static void __stdcall LogXml(const wchar_t* pszContext, const wchar_t* pszXml);

        // wchar_t native type exports
        #if defined(WEXLOGGER_EXPORTS)
        static void __stdcall CreateContext(const unsigned short* pszParentContext, const unsigned short* pszChildContext,
            const unsigned short* pszChildData);
        static void __stdcall CloseContext(const unsigned short* pszContext, TestResults::Result testResult);
        static void __stdcall LogComment(const unsigned short* pszContext, const unsigned short* pszComment);
        static void __stdcall LogFile(const unsigned short* pszContext, const unsigned short* pszFileName);
        static void __stdcall LogXml(const unsigned short* pszContext, const unsigned short* pszXml);
        #endif

    private:
        // Disallow construction of static class
        LogContext() = delete;
        ~LogContext() = delete;
        LogContext(const LogContext&) = delete;
        LogContext& operator=(const LogContext&) = delete;
    };
}/* namespace Logging */}/* namespace WEX */
#endif // #if defined(_WIN32)
