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

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

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

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