using Core.Interfaces.Stock;
using Domain.Entities;
using Domain.Generics;
using Models.Interfaces;

namespace Core.Services.Stock
{
    public class LSUnitOfMeasureService : ILSUnitOfMeasureDom
    {
        private readonly IPhLSMUnitOfMeasureRepository _repo;

        public LSUnitOfMeasureService(IPhLSMUnitOfMeasureRepository repo)
        {
            _repo = repo;
        }

        public Task<PagedResult<ELSUnitOfMeasure>> SearchAsync(string? text, int page = 1, int pageSize = 100)
            => _repo.SearchAsync(text, page, pageSize);

        public Task<ELSUnitOfMeasure?> GetByIdAsync(int id)
            => _repo.GetByIdAsync(id);

        public Task<int> AddAsync(ELSUnitOfMeasure model)
            => _repo.AddAsync(model);

        public Task UpdateAsync(ELSUnitOfMeasure model)
            => _repo.UpdateAsync(model);

        public Task<bool> ExistsByCodeAsync(string code)
            => _repo.ExistsByCodeAsync(code);

        public Task<List<string>> GetAllCodesAsync()
            => _repo.GetAllCodesAsync();
    }
}
