//
//  Created by Ivano Bilenchi on 11/05/18.
//  Copyright © 2018-2020 SisInf Lab. All rights reserved.
//

#import <Foundation/Foundation.h>

@class TMEReasoner;

NS_ASSUME_NONNULL_BEGIN

#pragma mark - Time units

/// Represents supported time units.
typedef NS_ENUM(NSInteger, TMETimeUnit) {

    /// Automatically determine the most appropriate time unit.
    TMETimeUnitAuto,

    /// Nanosecond time unit.
    TMETimeUnitNanos,

    /// Microsecond time unit.
    TMETimeUnitMicros,

    /// Millisecond time unit.
    TMETimeUnitMillis,

    /// Second time unit.
    TMETimeUnitSeconds
};

#pragma mark - Logger

/// Abstract logger class.
@interface TMELogger : NSObject

/// :nodoc:
- (instancetype)init UNAVAILABLE_ATTRIBUTE;

/**
 * Logs the TBox.
 *
 * @param reasoner Reasoner instance.
 */
- (void)logTBox:(TMEReasoner *)reasoner;

/**
 * Logs the ABox.
 *
 * @param reasoner Reasoner instance.
 */
- (void)logABox:(TMEReasoner *)reasoner;

/**
 * Logs the taxonomy computed by the specified reasoner instance.
 *
 * @param reasoner Reasoner instance.
 */
- (void)logTaxonomy:(TMEReasoner *)reasoner;

/**
 * Logs the specified object.
 *
 * @param obj Object to log.
 */
- (void)log:(NSObject *)obj;

/**
 * Logs the specified object and appends a newline character.
 *
 * @param obj Object to log.
 */
- (void)logln:(NSObject *)obj;


/// @name Abstract methods

/**
 * Logs the given string.
 *
 * @param string String to log.
 */
- (void)logString:(NSString *)string;

/**
 * Logs a prompt string followed by a formatted time interval.
 * Useful for logging benchmark results.
 *
 * @param nanos Time interval in nanoseconds.
 * @param prompt Prompt string.
 * @param timeUnit Desired time unit.
 */
- (void)logNanos:(unsigned long long)nanos
          prompt:(NSString *)prompt
        timeUnit:(TMETimeUnit)timeUnit;

/// Clears the logger, removing anything it has logged in the past.
- (void)clear;

@end

#pragma mark - Standard output logger

/// Logger class that logs to standard output.
@interface TMEConsoleLogger : TMELogger @end

#pragma mark - File logger

/// Logger class that logs to file.
@interface TMEFileLogger : TMELogger

/// URL of the output file.
@property (nonatomic, copy, readonly) NSURL *fileURL;

@end

#pragma mark - In-memory logger

/// Logger class that logs to a memory buffer.
@interface TMEMemoryLogger : TMELogger

/// Memory of the logger instance.
@property (nonatomic, copy, readonly) NSString *memory;

@end

#pragma mark - Null logger

/// Logger class that doesn't log anything.
@interface TMENullLogger : TMELogger @end

NS_ASSUME_NONNULL_END
