QrRapido/Services/IUserService.cs
Ricardo Carneiro 7a0c12f8d2
Some checks failed
Deploy QR Rapido / test (push) Failing after 17s
Deploy QR Rapido / build-and-push (push) Has been skipped
Deploy QR Rapido / deploy-staging (push) Has been skipped
Deploy QR Rapido / deploy-production (push) Has been skipped
feat: api separada do front-end e area do desenvolvedor.
2026-03-08 12:40:51 -03:00

56 lines
3.1 KiB
C#

using QRRapidoApp.Models;
using QRRapidoApp.Models.ViewModels;
namespace QRRapidoApp.Services
{
public interface IUserService
{
Task<User?> GetUserAsync(string userId);
Task<User?> GetUserByEmailAsync(string email);
Task<User?> GetUserByProviderAsync(string provider, string providerId);
Task<User> CreateUserAsync(string email, string name, string provider, string providerId);
Task UpdateLastLoginAsync(string userId);
Task ActivatePremiumStatus(string userId, string stripeSubscriptionId, DateTime expiryDate);
Task DeactivatePremiumStatus(string stripeSubscriptionId);
Task UpdateUserStripeCustomerIdAsync(string userId, string stripeCustomerId);
Task<User?> GetUserByStripeCustomerIdAsync(string customerId);
Task<bool> UpdateUserAsync(User user);
Task<int> GetDailyQRCountAsync(string? userId);
Task<int> IncrementDailyQRCountAsync(string userId);
Task<int> GetRemainingQRCountAsync(string userId);
Task<bool> CanGenerateQRAsync(string? userId, bool isPremium);
Task SaveQRToHistoryAsync(string? userId, QRGenerationResult qrResult, int costInCredits = 0);
Task<List<QRCodeHistory>> GetUserQRHistoryAsync(string userId, int limit = 50);
Task<QRCodeHistory?> GetQRDataAsync(string qrId);
Task<bool> DeleteQRFromHistoryAsync(string userId, string qrId);
Task<int> GetQRCountThisMonthAsync(string userId);
Task<string> GetUserEmailAsync(string userId);
Task MarkPremiumCancelledAsync(string userId, DateTime cancelledAt);
Task<List<User>> GetUsersForHistoryCleanupAsync(DateTime cutoffDate);
Task DeleteUserHistoryAsync(string userId);
// QR Code Tracking (Analytics) - Premium feature
Task<QRCodeHistory?> GetQRByTrackingIdAsync(string trackingId);
Task IncrementQRScanCountAsync(string trackingId);
// Credit System & Deduplication
Task<bool> DeductCreditAsync(string userId);
Task<bool> AddCreditsAsync(string userId, int amount);
Task<bool> IncrementFreeUsageAsync(string userId);
Task<QRCodeHistory?> FindDuplicateQRAsync(string userId, string contentHash);
// Anonymous Security
Task<bool> CheckAnonymousLimitAsync(string ipAddress, string deviceId);
Task RegisterAnonymousUsageAsync(string ipAddress, string deviceId, string qrId);
// API Key Management
Task<(string rawKey, string prefix)> GenerateApiKeyAsync(string userId, string keyName = "Default");
Task<bool> RevokeApiKeyAsync(string userId, string prefix);
Task<User?> GetUserByApiKeyAsync(string rawKey);
// API Subscription Management
Task ActivateApiSubscriptionAsync(string userId, string stripeSubscriptionId, ApiPlanTier tier, DateTime periodEnd, string stripeCustomerId);
Task<User?> GetUserByApiSubscriptionIdAsync(string stripeSubscriptionId);
Task UpdateApiSubscriptionStatusAsync(string stripeSubscriptionId, string status, ApiPlanTier? newTier = null, DateTime? periodEnd = null);
}
}