209 lines
6.6 KiB
C#
209 lines
6.6 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace MotoresArgentinosV2.Core.Entities;
|
|
|
|
public class Brand
|
|
{
|
|
public int BrandID { get; set; }
|
|
public int VehicleTypeID { get; set; }
|
|
public string Name { get; set; } = string.Empty;
|
|
public int? LegacyID { get; set; }
|
|
}
|
|
|
|
public class Model
|
|
{
|
|
public int ModelID { get; set; }
|
|
public int BrandID { get; set; }
|
|
public string Name { get; set; } = string.Empty;
|
|
public int? LegacyID { get; set; }
|
|
}
|
|
|
|
public enum UserMigrationStatus : byte { LegacyPending = 0, MigratedActive = 1 }
|
|
public enum AdStatusEnum
|
|
{
|
|
Draft = 1,
|
|
PaymentPending = 2,
|
|
ModerationPending = 3,
|
|
Active = 4,
|
|
Rejected = 5,
|
|
Paused = 6,
|
|
Sold = 7,
|
|
Expired = 8,
|
|
Deleted = 9,
|
|
Reserved = 10
|
|
}
|
|
|
|
public class User
|
|
{
|
|
public int UserID { get; set; }
|
|
public string UserName { get; set; } = string.Empty;
|
|
public string Email { get; set; } = string.Empty;
|
|
public string PasswordHash { get; set; } = string.Empty;
|
|
public string? PasswordSalt { get; set; }
|
|
public byte MigrationStatus { get; set; }
|
|
public string? FirstName { get; set; }
|
|
public string? LastName { get; set; }
|
|
public string? PhoneNumber { get; set; }
|
|
public byte UserType { get; set; } = 1; // 1: Particular, 3: Admin
|
|
public string? MFASecret { get; set; }
|
|
public bool IsMFAEnabled { get; set; }
|
|
|
|
// Email Verification
|
|
public bool IsEmailVerified { get; set; }
|
|
public string? VerificationToken { get; set; }
|
|
public DateTime? VerificationTokenExpiresAt { get; set; }
|
|
public DateTime? LastVerificationEmailSentAt { get; set; }
|
|
|
|
// Password Reset
|
|
public string? PasswordResetToken { get; set; }
|
|
public DateTime? PasswordResetTokenExpiresAt { get; set; }
|
|
public DateTime? LastPasswordResetEmailSentAt { get; set; }
|
|
|
|
// Bloqueo de usuario
|
|
public bool IsBlocked { get; set; }
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
// Relación con Refresh Tokens
|
|
public ICollection<RefreshToken> RefreshTokens { get; set; } = new List<RefreshToken>();
|
|
|
|
// Notificaciones de recordatorio de mensajes no leídos
|
|
public DateTime? LastUnreadMessageReminderSentAt { get; set; }
|
|
}
|
|
|
|
public class AuditLog
|
|
{
|
|
public int AuditLogID { get; set; }
|
|
public string Action { get; set; } = string.Empty;
|
|
public string Entity { get; set; } = string.Empty;
|
|
public int EntityID { get; set; }
|
|
public int UserID { get; set; }
|
|
public string Details { get; set; } = string.Empty;
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
}
|
|
|
|
public class Ad
|
|
{
|
|
public int AdID { get; set; }
|
|
public int UserID { get; set; }
|
|
public User User { get; set; } = null!;
|
|
|
|
public int VehicleTypeID { get; set; }
|
|
public int BrandID { get; set; }
|
|
public Brand Brand { get; set; } = null!;
|
|
public int ModelID { get; set; }
|
|
public Model Model { get; set; } = null!;
|
|
|
|
public string? VersionName { get; set; }
|
|
public int Year { get; set; }
|
|
public int KM { get; set; }
|
|
|
|
public string? FuelType { get; set; }
|
|
public string? Color { get; set; }
|
|
public string? Segment { get; set; }
|
|
|
|
public decimal Price { get; set; }
|
|
public string Currency { get; set; } = "USD";
|
|
public string? Description { get; set; }
|
|
|
|
public string? Location { get; set; }
|
|
public string? Condition { get; set; }
|
|
public int? DoorCount { get; set; }
|
|
public string? Transmission { get; set; }
|
|
public string? Steering { get; set; }
|
|
|
|
public string? ContactPhone { get; set; }
|
|
public string? ContactEmail { get; set; }
|
|
public bool DisplayContactInfo { get; set; } = true;
|
|
public bool IsFeatured { get; set; }
|
|
|
|
public int StatusID { get; set; }
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
public DateTime? PublishedAt { get; set; }
|
|
public DateTime? ExpiresAt { get; set; }
|
|
public int? LegacyAdID { get; set; }
|
|
public DateTime? DeletedAt { get; set; }
|
|
public int ViewsCounter { get; set; }
|
|
|
|
public ICollection<AdPhoto> Photos { get; set; } = new List<AdPhoto>();
|
|
public ICollection<AdFeature> Features { get; set; } = new List<AdFeature>();
|
|
public ICollection<ChatMessage> Messages { get; set; } = new List<ChatMessage>();
|
|
|
|
// CAMPOS DE CONTROL DE NOTIFICACIONES
|
|
public DateTime? LastPerformanceEmailSentAt { get; set; } // Para el resumen semanal
|
|
public DateTime? PaymentReminderSentAt { get; set; } // Para carrito abandonado
|
|
public bool ExpirationWarningSent { get; set; } // Para aviso por vencer
|
|
}
|
|
|
|
public class AdPhoto
|
|
{
|
|
public int PhotoID { get; set; }
|
|
public int AdID { get; set; }
|
|
public string FilePath { get; set; } = string.Empty;
|
|
public bool IsCover { get; set; }
|
|
public int SortOrder { get; set; }
|
|
public Ad Ad { get; set; } = null!;
|
|
}
|
|
|
|
public class AdFeature
|
|
{
|
|
public int AdID { get; set; }
|
|
public string FeatureKey { get; set; } = string.Empty;
|
|
public string? FeatureValue { get; set; }
|
|
}
|
|
|
|
public class TransactionRecord
|
|
{
|
|
public int TransactionID { get; set; }
|
|
public int AdID { get; set; }
|
|
public Ad Ad { get; set; } = null!;
|
|
public string OperationCode { get; set; } = string.Empty;
|
|
public int PaymentMethodID { get; set; }
|
|
public decimal Amount { get; set; }
|
|
public string Status { get; set; } = "PENDING";
|
|
public string? ProviderPaymentId { get; set; }
|
|
public string? ProviderResponse { get; set; }
|
|
public string? SnapshotUserEmail { get; set; }
|
|
public string? SnapshotUserName { get; set; }
|
|
public string? SnapshotAdTitle { get; set; }
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
public DateTime? UpdatedAt { get; set; }
|
|
}
|
|
public class Favorite
|
|
{
|
|
public int UserID { get; set; }
|
|
public int AdID { get; set; }
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
}
|
|
|
|
public class ChatMessage
|
|
{
|
|
[Key]
|
|
public int MessageID { get; set; }
|
|
public int AdID { get; set; }
|
|
|
|
[ForeignKey("AdID")]
|
|
[JsonIgnore]
|
|
public Ad? Ad { get; set; }
|
|
|
|
public int SenderID { get; set; }
|
|
public int ReceiverID { get; set; }
|
|
public string MessageText { get; set; } = string.Empty;
|
|
public DateTime SentAt { get; set; } = DateTime.UtcNow;
|
|
public bool IsRead { get; set; } = false;
|
|
}
|
|
|
|
public class PaymentMethod
|
|
{
|
|
public int PaymentMethodID { get; set; }
|
|
public string Name { get; set; } = string.Empty;
|
|
}
|
|
|
|
public class AdViewLog
|
|
{
|
|
public int Id { get; set; }
|
|
public int AdID { get; set; }
|
|
public string IPAddress { get; set; } = string.Empty;
|
|
public DateTime ViewDate { get; set; } = DateTime.UtcNow;
|
|
} |