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

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