import 'package:remever/common/typedef.dart';

enum LogLevel {
  ERROR,
  INFO,
  SUCCESS,
  DEBUG,
  WARNING;

  String get errName {
    switch (this) {
      case LogLevel.ERROR:
        return 'ERROR';

      case LogLevel.INFO:
        return 'INFO';

      case LogLevel.SUCCESS:
        return 'SUCCESS';

      case LogLevel.DEBUG:
        return 'DEBUG';

      case LogLevel.WARNING:
        return 'WARNING';
    }
  }
}

class LogEntity {
  LogEntity({
    required this.level,
    required this.message,
    this.context = const <String, dynamic>{},
  });

  LogEntity.error({
    required this.message,
    this.context = const <String, dynamic>{},
  }) : level = LogLevel.ERROR;

  LogEntity.info({
    required this.message,
    this.context = const <String, dynamic>{},
  }) : level = LogLevel.INFO;

  LogEntity.success({
    required this.message,
    this.context = const <String, dynamic>{},
  }) : level = LogLevel.SUCCESS;

  LogEntity.debug({
    required this.message,
    this.context = const <String, dynamic>{},
  }) : level = LogLevel.DEBUG;

  LogEntity.warning({
    required this.message,
    this.context = const <String, dynamic>{},
  }) : level = LogLevel.WARNING;

  final LogLevel level;
  final String message;
  final Json context;
}
