using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; namespace QRRapidoApp.Models { public class QRCodeHistory { [BsonId] [BsonRepresentation(BsonType.String)] public string Id { get; set; } = string.Empty; [BsonElement("userId")] public string? UserId { get; set; } // null for anonymous users [BsonElement("ipAddress")] public string? IpAddress { get; set; } [BsonElement("deviceId")] public string? DeviceId { get; set; } [BsonElement("type")] public string Type { get; set; } = string.Empty; // URL, Text, WiFi, vCard, SMS, Email [BsonElement("content")] public string Content { get; set; } = string.Empty; [BsonElement("contentHash")] public string ContentHash { get; set; } = string.Empty; // SHA256 Hash for deduplication [BsonElement("qrCodeBase64")] public string QRCodeBase64 { get; set; } = string.Empty; [BsonElement("customizationSettings")] public string CustomizationSettings { get; set; } = string.Empty; // JSON [BsonElement("createdAt")] public DateTime CreatedAt { get; set; } = DateTime.UtcNow; [BsonElement("language")] public string Language { get; set; } = "pt-BR"; [BsonElement("scanCount")] public int ScanCount { get; set; } = 0; [BsonElement("costInCredits")] public int CostInCredits { get; set; } = 0; // 0 = Free/Cache, 1 = Paid [BsonElement("isDynamic")] public bool IsDynamic { get; set; } = false; [BsonElement("trackingId")] public string? TrackingId { get; set; } // Public ID for tracking URL (premium feature) [BsonElement("size")] public int Size { get; set; } = 300; [BsonElement("generationTimeMs")] public long GenerationTimeMs { get; set; } = 0; [BsonElement("fromCache")] public bool FromCache { get; set; } = false; [BsonElement("isActive")] public bool IsActive { get; set; } = true; [BsonElement("lastAccessedAt")] public DateTime LastAccessedAt { get; set; } = DateTime.UtcNow; } }