using LSFE.MobApp.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LSFE.MobApp.Services
{
    public class RepositoryWrapper<T> : IRepository<T> where T : class, new()
    {
        private readonly Repository<T> _repository;

        public RepositoryWrapper(Repository<T> repository)
        {
            _repository = repository;
        }

        public async Task<List<T>> GetAllAsync() => await _repository.GetAllAsync();
        public async Task<T> GetByIdAsync(int id) => await _repository.GetByIdAsync(id);
        public async Task<List<T>> GetActiveAsync() => await _repository.GetActiveAsync();
        public async Task<int> SaveAsync(T item) => await _repository.SaveAsync(item);
        public async Task<int> UpdateAsync(T item) => await _repository.UpdateAsync(item);
        public async Task<int> DeleteAsync(T item) => await _repository.DeleteAsync(item);
        public async Task<int> DeleteAsync(int id) => await _repository.DeleteAsync(id);
        public async Task<int> TruncateAsync() => await _repository.TruncateAsync();
        public async Task<List<T>> QueryAsync(string query, params object[] args) => await _repository.QueryAsync(query, args);
        public async Task<T> FirstOrDefaultAsync(System.Linq.Expressions.Expression<Func<T, bool>> predicate) => await _repository.FirstOrDefaultAsync(predicate);
        public async Task<List<T>> WhereAsync(System.Linq.Expressions.Expression<Func<T, bool>> predicate) => await _repository.WhereAsync(predicate);
    }
}
