using MongoDB.Driver; using QRRapidoApp.Data; using QRRapidoApp.Models; using System.Collections.Generic; using System.Threading.Tasks; namespace QRRapidoApp.Services { public class PlanService : IPlanService { private readonly IMongoCollection _plans; public PlanService(MongoDbContext context) { _plans = context.Plans; } public async Task> GetActivePlansAsync() { return await _plans.Find(p => p.IsActive).SortBy(p => p.PricesByCountry["BRL"].Amount).ToListAsync(); } public async Task> GetPlansByLanguageAsync(string languageCode, string countryCode = "BRL") { var plans = await _plans.Find(p => p.IsActive).SortBy(p => p.PricesByCountry[countryCode].Amount).ToListAsync(); return plans; } public async Task GetPlanByIdAsync(string id) { return await _plans.Find(p => p.Id == id).FirstOrDefaultAsync(); } } }