using Insight.Infrastructure.Entities;
using Insight.Infrastructure.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using MongoDB.Driver;

namespace Insight.Infrastructure.Services
{
    public class InventoryService
    {
        private readonly IMongoDatabase _database;
        private readonly ILogger<InventoryService> _logger;

        public InventoryService(IMongoDatabase database, ILogger<InventoryService> logger)
        {
            _database = database;
            _logger = logger;
        }

        public Task<PagedList<HostApplicationEntity>> GetAsync(
            FilterDefinition<HostApplicationEntity>? filter = null,
            SortDefinition<HostApplicationEntity>? sort = null,
            int offset = 0,
            int limit = 10,
            CancellationToken cancellationToken = default) => _database.HostApplication().GetPagedAsync(filter, sort, offset, limit, cancellationToken);

        public Task<PagedList<HostApplicationEntity>> GetAsync(
            HttpRequest request,
            HttpResponse response,
            FilterDefinition<HostApplicationEntity>? filter = null,
            SortDefinition<HostApplicationEntity>? sort = null,
            int offset = 0,
            int limit = 10,
            CancellationToken cancellationToken = default) => _database.HostApplication().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken);
    }
}