using HRD.AppLogger;
using HRD.WebApi.DAL;
using Microsoft.AspNetCore.Mvc;
using System;

namespace HRD.WebApi.Controllers
{
    [Route("api/[controller]")]
    [Produces("application/json")]
    [ApiController]
    public abstract class BaseMiniController : Microsoft.AspNetCore.Mvc.Controller
    {
        private readonly ILoggerManager _logger;
        public readonly WebApiBaseContext Context;

        public BaseMiniController(WebApiBaseContext webApiBaseContext)
        {
            Context = webApiBaseContext;
            _logger = new LoggerManager();
        }

        [NonAction]
        public void WriteLogDebug(string message, String entityMessage = null)
        {
            WriteLogDebug(message, entityMessage);
        }

        [NonAction]
        public void WriteLogError(string message, String entityMessage = null)
        {
            _logger.LogError(message, entityMessage);
        }

        [NonAction]
        public void WriteLogException(Exception exception, String entityMessage = null)
        {
            _logger.LogException(exception, entityMessage);
        }

        [NonAction]
        public void WriteLogInfo(string message)
        {
            _logger.LogInfo(message);
        }

        [NonAction]
        public void WriteLogWarn(string message, String entityMessage = null)
        {
            _logger.LogWarn(message, entityMessage);
        }
    }
}