using Core.Interfaces;
using Domain.Entities;
using Models.Interfaces;
using System.Reflection;

namespace Core.Services
{
    public class AdjustmentReasonService:IAdjustmentReasonDom
    {
        #region Declaraciones y Constructor
        private readonly IPhSAdjustmentReasonRepository _repository;
        public AdjustmentReasonService(IPhSAdjustmentReasonRepository repository)
        {
            _repository = repository ?? throw new ArgumentNullException(nameof(repository));
        }
        #endregion
        #region Metodos de clase
        public async Task<IEnumerable<EAdjustmentReason>> GetAllActiveAsync()
        {
            try
            {
                return await _repository.GetAllActiveAsync();
            }
            catch (Exception ex)
            {
                var methodName = MethodBase.GetCurrentMethod()?.Name ?? "UnknownMethod";
                throw new Exception($"{methodName} Message: {ex.Message}", ex);
            }
        }
        #endregion
    }
}
