using LSFE.Domain.Contracts.Doctor;
using LSFE.Infrastructure.Database;
using LSFE.Infrastructure.Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LSFE.Domain.Services
{
    public interface IErrorLogger 
    {
        Task LogErrorAsync(ErrorLogs error);
    }

    public class ErrorLogger : GenericRepository<Infrastructure.Entities.ErrorLogs>, IErrorLogger
    {
        private readonly LSFEDbContext _context;
        public ErrorLogger(LSFEDbContext context) : base(context)
        {
            _context = context;
        }
        public async Task LogErrorAsync(ErrorLogs error)
        {
            await _dbContext.AddAsync(error);
            await _dbContext.SaveChangesAsync();
        }
    }
}
