using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace LittleShop.Models; public class OrderItem { [Key] public Guid Id { get; set; } public Guid OrderId { get; set; } public Guid ProductId { get; set; } public Guid? ProductMultiBuyId { get; set; } // Nullable for backward compatibility public Guid? ProductVariantId { get; set; } // Optional: specific variant with potential price override [StringLength(500)] public string? SelectedVariants { get; set; } // JSON array of variants chosen (e.g., ["Red", "Blue", "Green"] for multi-buy) public int Quantity { get; set; } [Column(TypeName = "decimal(18,2)")] public decimal UnitPrice { get; set; } [Column(TypeName = "decimal(18,2)")] public decimal TotalPrice { get; set; } // Navigation properties public virtual Order Order { get; set; } = null!; public virtual Product Product { get; set; } = null!; public virtual ProductMultiBuy? ProductMultiBuy { get; set; } public virtual ProductVariant? ProductVariant { get; set; } }