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

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

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

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