Files
2026-01-29 13:43:44 -03:00

120 lines
3.7 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace MotoresArgentinosV2.Core.DTOs;
public class CreateAdRequestDto
{
[Required]
[Range(1, 3, ErrorMessage = "Tipo de vehículo inválido")]
[JsonPropertyName("vehicleTypeID")]
public int VehicleTypeID { get; set; }
[Required]
[JsonPropertyName("brandID")]
public int BrandID { get; set; }
[JsonPropertyName("modelID")]
public int ModelID { get; set; }
[Required]
[StringLength(100, MinimumLength = 1, ErrorMessage = "La versión debe tener entre 1 y 100 caracteres.")]
[RegularExpression(@"^[a-zA-Z0-9\s\-\.\(\),/áéíóúÁÉÍÓÚñÑ]+$", ErrorMessage = "Caracteres no permitidos en el nombre de versión.")]
[JsonPropertyName("versionName")]
public string VersionName { get; set; } = string.Empty;
[Range(1900, 2100)]
[JsonPropertyName("year")]
public int Year { get; set; }
[Range(0, 2000000)]
[JsonPropertyName("km")]
public int KM { get; set; }
[Range(0, 999999999)]
[JsonPropertyName("price")]
public decimal Price { get; set; }
[Required]
[StringLength(3, MinimumLength = 3)]
[RegularExpression(@"^(ARS|USD)$", ErrorMessage = "Moneda inválida.")]
[JsonPropertyName("currency")]
public string Currency { get; set; } = "ARS";
[StringLength(1000, ErrorMessage = "La descripción no puede superar los 1000 caracteres.")]
[RegularExpression(@"^(?!.*<script>).*$", ErrorMessage = "Contenido no permitido.")]
[JsonPropertyName("description")]
public string Description { get; set; } = string.Empty;
[JsonPropertyName("isFeatured")]
public bool IsFeatured { get; set; }
[StringLength(50)]
[JsonPropertyName("fuelType")]
public string? FuelType { get; set; }
[StringLength(50)]
[JsonPropertyName("color")]
public string? Color { get; set; }
[StringLength(50)]
[JsonPropertyName("segment")]
public string? Segment { get; set; }
[StringLength(100)]
[JsonPropertyName("location")]
public string? Location { get; set; }
[StringLength(50)]
[JsonPropertyName("condition")]
public string? Condition { get; set; }
[JsonPropertyName("doorCount")]
public int? DoorCount { get; set; }
[StringLength(50)]
[JsonPropertyName("transmission")]
public string? Transmission { get; set; }
[StringLength(50)]
[JsonPropertyName("steering")]
public string? Steering { get; set; }
// --- Contacto Personalizado ---
[StringLength(50)]
[RegularExpression(@"^\+?[0-9\s\-\(\)]+$", ErrorMessage = "Formato de teléfono inválido.")]
[JsonPropertyName("contactPhone")]
public string? ContactPhone { get; set; }
[StringLength(100)]
[EmailAddress(ErrorMessage = "Formato de email inválido.")]
[JsonPropertyName("contactEmail")]
public string? ContactEmail { get; set; }
[JsonPropertyName("displayContactInfo")]
public bool DisplayContactInfo { get; set; } = true;
// --- Admin Only ---
[JsonPropertyName("targetUserID")]
public int? TargetUserID { get; set; }
[StringLength(100)]
[EmailAddress(ErrorMessage = "Email de usuario fantasma inválido.")]
[JsonPropertyName("ghostUserEmail")]
public string? GhostUserEmail { get; set; }
[StringLength(100)]
[JsonPropertyName("ghostFirstName")]
public string? GhostFirstName { get; set; }
[StringLength(100)]
[JsonPropertyName("ghostLastName")]
public string? GhostLastName { get; set; }
[StringLength(50)]
[RegularExpression(@"^\+?[0-9\s\-\(\)]+$", ErrorMessage = "Teléfono de usuario fantasma inválido.")]
[JsonPropertyName("ghostUserPhone")]
public string? GhostUserPhone { get; set; }
}