import Foundation

/// A utility class for handling logging in the BlueStack SDK.
/// This class provides different log levels and respects the debug mode setting.
public class BlueStackLogger {
    /// Log levels for different types of messages
    public enum LogLevel: String {
        case debug = "BlueStack Bridge DEBUG"
        case info = "BlueStack Bridge INFO"
        case warning = "BlueStack Bridge WARNING"
        case error = "BlueStack Bridge ERROR"
    }
    
    /// Logs a debug message. Only prints if debug mode is enabled.
    /// - Parameters:
    ///   - tag: The tag to identify the source of the log
    ///   - message: The message to log
    public static func debug(tag: String, message: String) {
        if BluestackManager.sharedInstance?.isInDebugMode() ?? false {
            print("[\(LogLevel.debug.rawValue)] [\(tag)] \(message)")
        }
    }
    
    /// Logs an info message. Always prints regardless of debug mode.
    /// - Parameters:
    ///   - tag: The tag to identify the source of the log
    ///   - message: The message to log
    public static func info(tag: String, message: String) {
        print("[\(LogLevel.info.rawValue)] [\(tag)] \(message)")
    }
    
    /// Logs a warning message. Always prints regardless of debug mode.
    /// - Parameters:
    ///   - tag: The tag to identify the source of the log
    ///   - message: The message to log
    public static func warning(tag: String, message: String) {
        print("[\(LogLevel.warning.rawValue)] [\(tag)] \(message)")
    }
    
    /// Logs an error message. Always prints regardless of debug mode.
    /// - Parameters:
    ///   - tag: The tag to identify the source of the log
    ///   - message: The message to log
    public static func error(tag: String, message: String) {
        print("===[\(LogLevel.error.rawValue)]===");
        print("[\(tag)] \(message)")
        print("===========================");
    }
} 
