using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; using BCards.Web.ViewModels; namespace BCards.Web.Models; public class UserPage : IPageDisplay { [BsonId] [BsonRepresentation(BsonType.ObjectId)] public string Id { get; set; } = string.Empty; [BsonElement("userId")] [BsonRepresentation(BsonType.ObjectId)] public string UserId { get; set; } = string.Empty; [BsonElement("slug")] public string Slug { get; set; } = string.Empty; [BsonElement("category")] public string Category { get; set; } = string.Empty; [BsonElement("businessType")] public string BusinessType { get; set; } = "individual"; // individual, company [BsonElement("displayName")] public string DisplayName { get; set; } = string.Empty; [BsonElement("bio")] public string Bio { get; set; } = string.Empty; [BsonElement("profileImageId")] public string? ProfileImageId { get; set; } // Campo antigo - ignorar durante deserialização para compatibilidade [BsonElement("profileImage")] [BsonIgnoreIfDefault] [BsonIgnore] public string? ProfileImage { get; set; } [BsonElement("theme")] public PageTheme Theme { get; set; } = new(); [BsonElement("links")] public List Links { get; set; } = new(); [BsonElement("seoSettings")] public SeoSettings SeoSettings { get; set; } = new(); [BsonElement("language")] public string Language { get; set; } = "pt-BR"; [BsonElement("analytics")] public PageAnalytics Analytics { get; set; } = new(); [BsonElement("isActive")] public bool IsActive { get; set; } = true; [BsonElement("planLimitations")] public PlanLimitations PlanLimitations { get; set; } = new(); [BsonElement("createdAt")] public DateTime CreatedAt { get; set; } = DateTime.UtcNow; [BsonElement("updatedAt")] public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; [BsonElement("publishedAt")] public DateTime? PublishedAt { get; set; } [BsonElement("status")] public PageStatus Status { get; set; } = PageStatus.Active; [BsonElement("previewToken")] public string? PreviewToken { get; set; } [BsonElement("previewTokenExpiry")] public DateTime? PreviewTokenExpiry { get; set; } [BsonElement("moderationAttempts")] public int ModerationAttempts { get; set; } = 0; [BsonElement("moderationHistory")] public List ModerationHistory { get; set; } = new(); [BsonElement("approvedAt")] public DateTime? ApprovedAt { get; set; } [BsonElement("userScore")] public int UserScore { get; set; } = 100; [BsonElement("previewViewCount")] public int PreviewViewCount { get; set; } = 0; public string FullUrl => $"page/{Category}/{Slug}"; /// /// URL da imagem de perfil ou imagem padrão se não houver upload /// [BsonIgnore] public string ProfileImageUrl => !string.IsNullOrEmpty(ProfileImageId) ? $"/api/image/{ProfileImageId}" : "/images/default-avatar.svg"; }