using Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Models.Helpers;
using Models.Interfaces;
using Models.Models;

namespace Models.Repositories
{
    public class PhSAdjustmentReasonRepository(PhronCareOperationsHubContext context) : IPhSAdjustmentReasonRepository
    {
        #region Declaraciones y Constructor
        private readonly PhronCareOperationsHubContext _context = context;
        #endregion
        #region Metodos de clase
        public async Task<IEnumerable<EAdjustmentReason>> GetAllActiveAsync()
        {
            var adjustement= await _context.PhSAdjustmentReasons
                .Where(x => x.Active)
                .OrderBy(x => x.Code)
                .ToListAsync();
            return adjustement.Select(EntityMapper.MapEntity<PhSAdjustmentReason, EAdjustmentReason>);
        }
        #endregion
    }
}
