using UnityEditor;
using UnityEngine;

namespace Alibabacloud.Rum.Unity.Editor
{
    internal static class LoggingTab
    {
        internal static void Display(AlibabacloudOptions options)
        {
            EditorGUILayout.LabelField("Logging Configuration", EditorStyles.boldLabel);
            EditorGUILayout.Space(5);

            // Enable Structured Logging toggle
            options.EnableStructuredLogging = EditorGUILayout.Toggle(
                new GUIContent("Enable Structured Logging", "Enable structured logging to forward Unity logs to Alibabacloud"),
                options.EnableStructuredLogging);

            EditorGUILayout.Space(10);

            GUI.enabled = options.Enabled && options.EnableStructuredLogging;

            EditorGUILayout.LabelField("Log Level Capture", EditorStyles.boldLabel);
            EditorGUILayout.Space(5);

            // Debug.LogException
            options.StructuredLogOnDebugLogException = EditorGUILayout.Toggle(
                new GUIContent("Debug.LogException", "Whether the SDK should forward Debug.LogException messages to Alibabacloud structured logging"),
                options.StructuredLogOnDebugLogException);
            
            // Debug.Log
            options.StructuredLogOnDebugLog = EditorGUILayout.Toggle(
                new GUIContent("Debug.Log", "Whether the SDK should forward Debug.Log messages to Alibabacloud structured logging"),
                options.StructuredLogOnDebugLog);

            // Debug.LogWarning
            options.StructuredLogOnDebugLogWarning = EditorGUILayout.Toggle(
                new GUIContent("Debug.LogWarning", "Whether the SDK should forward Debug.LogWarning messages to Alibabacloud structured logging"),
                options.StructuredLogOnDebugLogWarning);

            // Debug.LogAssertion
            options.StructuredLogOnDebugLogAssertion = EditorGUILayout.Toggle(
                new GUIContent("Debug.LogAssertion", "Whether the SDK should forward Debug.LogAssertion messages to Alibabacloud structured logging"),
                options.StructuredLogOnDebugLogAssertion);
            
            // Debug.LogError
            options.StructuredLogOnDebugLogError = EditorGUILayout.Toggle(
                new GUIContent("Debug.LogError", "Whether the SDK should forward Debug.LogError messages to Alibabacloud structured logging"),
                options.StructuredLogOnDebugLogError);

            GUI.enabled = true;

            if (!options.EnableStructuredLogging && options.Enabled)
            {
                EditorGUILayout.Space(10);
                EditorGUILayout.HelpBox("Enable Structured Logging to configure log capture settings", MessageType.Info);
            }
        }
    }
}

