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 HostService
    {
        private readonly IMongoDatabase _database;
        private readonly ILogger<HostService> _logger;

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

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

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